I have a issue with case sensitive directory listing in my bash. for example
$ touch nohupa nohuPb
$ ls nohup*
nohupa nohuPb
However I do expect it only list nohupa not nohuPb. because nohuPb has capital P. I don't know what variable in my .bashrc set that * works ignore case.
Any idea ?
$1 means an input argument and -z means non-defined or empty. You're testing whether an input argument to the script was defined when running the script. Follow this answer to receive notifications.
bash [filename] runs the commands saved in a file. $@ refers to all of a shell script's command-line arguments. $1 , $2 , etc., refer to the first command-line argument, the second command-line argument, etc.
The $$ variable is the PID (Process IDentifier) of the currently running shell. This can be useful for creating temporary files, such as /tmp/my-script. $$ which is useful if many instances of the script could be run at the same time, and they all need their own temporary files.
In the bash shell, ${! var} is a variable indirection. It expands to the value of the variable whose name is kept in $var . The variable expansion ${var+value} is a POSIX expansion that expands to value if the variable var is set (no matter if its value is empty or not).
It's nocaseglob
that causes that.
nocaseglob
If set, bash matches filenames in a case-insensitive fashion when performing pathname expansion (see Pathname Expansion above).
testing
$ touch fooab fooAb
$ ls
fooAb fooab
$ shopt -s nocaseglob
$ ls fooa*
fooAb fooab
$ shopt -u nocaseglob
$ ls fooa*
fooab
Looks like your shell has the nocaseglob
set. You can unset it by using a shell built-in
called shopt
. Use -s
option to enable
it and -u
option to disable
it.
For more reference you can visit here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With