Not an exact answer, but ran into this trick. If the string you're looking for comes from "a command" then you can actually store the command in an env. variable and then execute it every time for the if statement, then no brackets required!
For example this command, which determines if you're on debian:
grep debian /proc/version
Add these line to the end of the file:
Save the file. Restart or use the below command:
Test your ...
Following off of what others said, the set manual is a good resource. I put:
exec 1> command.log 2>&1
At the top of scripts I wish to keep going, or set -ex if it should exit upon error.
One method that comes to mind is to iterate over the list of mountpoints and see how many files are present under each one. A value of 1 probably means the filesystem isn't mounted (and only the directory itself is present). This strategy won't work if the mountpoints are nested, however. By "nested" I mean mountpoints like:
Combining the test command with the -d flag and checking to see if the mount exists per this question:
if mountpoint -q "$mount" && test -d /path/to/share; then
cp -ru /path/to/files /. -t /path/to/share
Edited per Michael Hampton's comment.
At least bash-completion 2.8 and later enable option to place local Bash completions in directory
The completion file names or symbolic link names must match the respective command names. These completions are loaded only on demand. Completions stored in file ~/.bash_completion are ...
It seems that with newer versions of sudo this problem is solved:
On my gentoo laptop:
$ sudo -k
$ echo "$PW" | sudo -S -p "" whoami
$ sudo --version
Sudo version 1.8.25p1
Sudoers policy plugin version 1.8.25p1
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.25p1
On older Ubuntu machines you can simply redirect the prompt to /dev/null:...