What did I just do?

I was perhaps being a bit too trial and errory, but I typed “bash --info” into the terminal. Now instead of “me@me” it says “bash-4.1” and nothing I type in does anything at all.
Now if I just open another terminal that’s fine back to normal, but I still want to know what I just did, what its for, and how in the event of doing it again to just make it go back to normal.

I am bit confused:

Die std./default-Shell with the most systems is the bash shell. Calling “bash --info” just does produce the parameters when invoking the bash, because bash tells you that it does not know a parameter “–info”:


swen@Augustus:~$ bash --info
bash: --info: invalid option
Usage:  bash [GNU long option] [option] ...
        bash [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
        --wordexp
Shell options:
        -irsD or -c command or -O shopt_option          (invocation only)
        -abefhkmnptuvxBCHP or -o option
swen@Augustus:~$    

It seems for me more that you opened an other sub-shell (a shell in the shell). You always can leave a shell with “exit”. Example here I am first in bash and than in csh than in a local ssh-root and leave one after the other one with “exit”:


swen@Augustus:~$ csh
% ssh -l root 127.0.0.1
[email protected]'s password:
Linux Augustus 2.6.26-2-amd64 #1 SMP Wed May 12 18:03:14 UTC 2010 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 23 02:12:14 2010 from localhost
Augustus:~# exit
logout
Connection to 127.0.0.1 closed.
% exit
% exit
swen@Augustus:~$

I think she misstyped… I got the same results with

bash -info

and

exit

does nothing

Ah yeah… probably the mistyped thing, exit indeed does nothing…

Shut in the own feed - solution of the miracle:

bash -c "help set"
set: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
        -a  Mark variables which are modified or created for export.
        -b  Notify of job termination immediately.
        -e  Exit immediately if a command exits with a non-zero status.
        -f  Disable file name generation (globbing).
        -h  Remember the location of commands as they are looked up.
        -k  All assignment arguments are placed in the environment for a
            command, not just those that precede the command name.
        -m  Job control is enabled.
        -n  Read commands but do not execute them.

So you say the bash -i (interactive) and -n (do nothing) … and it does nothing.


Normally you do use those parameters - funny option “-n” … I looked up: According to “our bible”: UNIX, Unleashed, 3rd ed. , 596 this is used to check the formal syntax of shellscripts. Makes some sense.

ROFL! What is the purpose of the “do nothing” option?

Ok, what you actually did was;

bash -info

Note the use of the “single” minus sign. If you use “double” minus signs, for example “–info”, this signifies “long” command line options, i.e. a ‘word’ is expected after the minus sign to specify the action. (this is the ‘newer’ format for command line tools) The older format uses a single minus sign followed by a letter, so for example you might use;

ls -a

OR

ls --all

These both do the same thing. One step further, the short options can be concatenated behind a single minus sign so for example;

ls --all --inode

Is the same as;

ls -ai

… you see where this is going … you typed;

bash -info

Which is the same as;

bash -i -n -f -o

And bash -n enters a ‘sub’ shell, with the -n telling bash not to execute any command, so the -i -f -o are ignored. Because bash doesn’t execute any command with -n, it doesn’t execute the startup routine, which sets the default prompt to be your username @ your machine name, hence the prompt is left as the bash default which is bash-version$.

Make sense?

As I said above and modified my entry:

Checking the formal syntax of shell scripts.

Thank you all for my enlightenment. :smiley: