How to extract domain name from url?
You can use simple AWK way to extract the domain name as follows: echo http://example.com/index.php | awk -F[/:] ‘{print $4}’ OUTPUT: example.com 🙂
You can use simple AWK way to extract the domain name as follows: echo http://example.com/index.php | awk -F[/:] ‘{print $4}’ OUTPUT: example.com 🙂
Like this: name=$(date ‘+%Y-%m-%d’) tar -zcvf “$name.tar.gz” code or even in one line: tar -zcvf “$(date ‘+%Y-%m-%d’).tar.gz” code Drop -z flag if you want .tar instead of .tar.gz. Use %y instead of %Y if you want just 2 digits of a year (17 instead of 2017). $() is used for command substitution.
readarray -d ” entries < <(printf ‘%s\0’ *.fas | sort -zV) for entry in “${entries[@]}”; do # do something with $entry done where printf ‘%s\0’ *.fas yields a NUL separated list of directory entries with the extension .fas, and sort -zV sorts them in natural order. Note that you need GNU sort installed in order … Read more
With all due respect to the users of pgrep, pkill, ps | awk, etc, there is a much better way. Consider that if you rely on ps -aux | grep … to find a process you run the risk of a collision. You may have a use case where that is unlikely, but as a … Read more
Just did this really easy and quick. First create a ~/.bash_profile from terminal: touch ~/.bash_profile then open -a TextEdit.app ~/.bash_profile add export TOMCAT_HOME=/Library/Tomcat/Home Save document in TextEdit and you are done.
From wikipedia Bash When Bash starts, it executes the commands in a variety of different scripts. When Bash is invoked as an interactive login shell, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads … Read more
column(1) is your friend. $ column -t <<< ‘”option-y” yank-pop > “option-z” execute-last-named-cmd > “option-|” vi-goto-column > “option-~” _bash_complete-word > “option-control-?” backward-kill-word > “control-_” undo > “control-?” backward-delete-char > ‘ “option-y” yank-pop “option-z” execute-last-named-cmd “option-|” vi-goto-column “option-~” _bash_complete-word “option-control-?” backward-kill-word “control-_” undo “control-?” backward-delete-char
Before actually using GUI dialogues, consider using console prompts. Quite often you can get away with simple “y/n?” prompts, which in bash you achieve via the read command.. read -p “Do something? “; if [ $REPLY == “y” ]; then echo yay; fi If console prompt’s just won’t cut it, Zenity is really easy to … Read more
Try this So, you need to put: user: “${UID}:${GID}” in your docker compose and provide UID and GID as docker-compose parameter UID=${UID} GID=${GID} docker-compose up (or define UID and GID as environment variables).
The –ntasks parameter is useful if you have commands that you want to run in parallel within the same batch script. This may be two separate commands separated by an & or two commands used in a bash pipe (|). For example Using the default ntasks=1 #!/bin/bash #SBATCH –ntasks=1 srun sleep 10 & srun sleep … Read more