from "man 1 passwd": --stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe. So in your case adduser "$1" echo "... Read More
The * is expanded, what you can do is use sed instead of grep and get the name of the branch immediately: branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') And a version using git symbolic-ref, as... Read More
You can use: printf '=%.0s' {1..100} How this works: Bash expands {1..100} so the command becomes: printf '=%.0s' 1 2 3 4 ... 100 I've set printf's format to =%.0s which means that it will always p... Read More
I've had some success in solving this problem of mine. Here are the details, with some explanations, in case anyone having a similar problem finds this page. But if you don't care for details, here's... Read More
Neovim and Vim 8.2 support this natively via the :ter[minal] command. See terminal-window in the docs for details.... Read More
I think --include is used to include a subset of files that are otherwise excluded by --exclude, rather than including only those files. In other words: you have to think about include meaning don't... Read More
In bash, you should do your check in arithmetic context: if (( a > b )); then ... fi For POSIX shells that don't support (()), you can use -lt and -gt. if [ "$a" -gt "$b" ]; then ... fi You... Read More
One way to capture colorized output is with the script command. Running script will start a bash session where all of the raw output is captured to a file (named typescript by default).... Read More
The & makes the command run in the background. From man bash: If a command is terminated by the control operator & , the shell executes the command in the background in a subshell. The shell does no... Read More
You can add to the crontab as follows: #write out current crontab crontab -l > mycron #echo new cron into cron file echo "00 09 * * 1-5 echo hello" >> mycron #install new cron file crontab mycron rm... Read More