[sf-lug] shell, man(1) [was: path name expansion]
Alex Kleider
akleider at sonic.net
Sat Aug 20 08:59:29 PDT 2016
On 2016-08-19 11:13, Michael Paoli wrote:
> If it's lines you're counting, can certainly be done in one line:
> $ mkdir Dir{A..C} && touch Dir{A..C}/file{1..3}
Commands, not lines; my slopyness in using one rather than the other.
>
> $ type set
> set is a shell builtin
> $ ls -l /proc/$$/exe
> lrwxrwxrwx 1 michael users 0 Jul 10 16:09 /proc/7940/exe -> /bin/bash
> $ man bash
> ...
> set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
> set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
> Without options, the name and value of each shell variable are
> displayed in a format that can be reused as input for setting or
> resetting the currently-set variables. Read-only variables can-
> not be reset. In posix mode, only shell variables are listed.
> The output is sorted according to the current locale. When
> options are specified, they set or unset shell attributes. Any
> arguments remaining after option processing are treated as val-
> ues for the positional parameters and are assigned, in order, to
> $1, $2, ... $n. Options, if specified, have the following
> meanings:
> ...
> $ printenv | grep SHELL | grep -v '^XT'
> SHELL=And why would you think this tells you the shell you're running?
> $
> What SHELL is set to in the environment, and the shell one is running,
> are not necessarily the same ... hopefully obvious by my example
> above.
Not obvious to me at all, I must confess.
printenv and set do not appear to be doing the same thing.
alex at X301n3:~/Test$ printenv | grep SHELL | grep -v '^XT'
SHELL=/bin/bash
alex at X301n3:~/Test$ set | grep '^BASH_VERSION='
BASH_VERSION='4.3.11(1)-release'
alex at X301n3:~/Test$ printenv | grep '^BASH_VERSION='
I don't understand the grep -v '^XT' part.
ak
More information about the sf-lug
mailing list