BASH_ENV SHELLOPTS BASH_COMMAND

BASH_ENV is the name of a file (which may be a relative path, in which case be very careful about where you run your scripts from!) which is parsed before executing the file,
much as ~/.bashrc is parsed before starting an interactive shell.


echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHELLOPTS is similar to BASHOPTS; it is a list of -o options set. So if you set -o vi, then vi will appear in the list of options, and the shell will work in its vi. Like BASHOPTS, SHELLOPTS is read-only

BASH_COMMAND is the name of the currently executing command.


BASH_SOURCE, FUNCNAME, LINENO and BASH_LINENO are incredibly useful debugging variables that tell you just where you are in the script, even when you have multiple files in use. LINENO simply gives you the current line number in the script:

ubuntu2@ubuntu2:~/temp$ cat f1
#!/bin/bash 
echo “Hello, World” 
echo “This is line $LINENO” 
ubuntu2@ubuntu2:~/temp$ bash f1
“Hello, World”
“This is line 3”





Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all