Linked Questions

14 votes
3 answers
4k views

If I run this bash command and prefix the statement, so that the variable fruit should exist, but only for the duration of this command: $ fruit=apple echo $fruit $ The result is an empty line. why? ...
the_velour_fog's user avatar
10 votes
2 answers
43k views

I have this sample bash command: FILE='/tmp/1.txt' echo "file: $FILE" and the output is: file: Why the output doesn't contain defined earlier variable FILE?
Kossak's user avatar
  • 689
10 votes
4 answers
2k views

Is there any standard that covers the portability of running a command after variable assignment on the same line? APPLE="cider" echo hi How portable is something like that? Where will it work and ...
test's user avatar
  • 649
0 votes
3 answers
6k views

AFAIK, cat is an external command and it forks off a new process when executed, just like sh -c or executing a script. With that said I expect cat to use its command environment as it is used by ...
haccks's user avatar
  • 203
0 votes
1 answer
1k views

On Ubuntu-like linux, the default .bashrc file contains a line: [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" Then why is SHELL=/bin/sh lesspipe grammatically correct? What ...
ynn's user avatar
  • 1,008
2 votes
3 answers
304 views

When I run PATH=abc:$PATH echo $PATH, I get the old value for PATH, not abc:PATH Why is this? How can I get abc:$PATH? Edit: How about for PATH=/mybin:$PATH which python if /mybin has a python ...
Jonathan Allen Grant's user avatar
2 votes
1 answer
1k views

When I run this command: https_proxy=http://myproxy.com/ aws [aws-param] the proxy is picked up by the aws command line tool. However - when I do this: https_proxy=http://myproxy.com/ aws [aws-...
hawkeye's user avatar
  • 515
0 votes
1 answer
104 views

I have come across commands like this: CC=gcc ./configure What is the effect of it exactly? Is it identical with export CC=gcc ./configure ? Does the variable CC continue to exist after ...
apadana's user avatar
  • 133
0 votes
1 answer
61 views

Below I run what I expected to be an invalid command: var=3 date, which in fact isn't. $ var=3 date Sun May 26 17:10:22 UTC 2019 $ echo $? 0 But the variable wasn't assigned the value 3: $ echo $var ...
Damn Spaces's user avatar
1 vote
4 answers
593 views

In Bash and Posix shells, there are many forms of commands, and an assignment is a form of command (specifically a simple command) if I am correct. However let can be used in front of an assignment, ...
Tim's user avatar
  • 107k