Firefox refresh current tab from command-line

You can use xdotool for automation. Install on Ubuntu with sudo aptitude install xdotool Then you can search for windows and send keys or mouse events, see man xdotool for the full documentation. I use following script on Ubuntu 16.04 LTS during development: WID=`xdotool search –name “Mozilla Firefox” | head -1` xdotool windowactivate $WID xdotool … Read more

Declaring global variable inside a function

declare inside a function doesn’t work as expected. I needed read-only global variables declared in a function. I tried this inside a function but it didn’t work: declare -r MY_VAR=1 But this didn’t work. Using the readonly command did: func() { readonly MY_VAR=1 } func echo $MY_VAR MY_VAR=2 This will print 1 and give the … Read more

How to expand shell variables in a text file?

This question has been asked in another thread, and this is the best answer IMO: export LOG_FILE_PATH=/expanded/path/of/the/log/file/../logfile.log cat Text_File.msh | envsubst > Text_File_expanded.msh if on Mac, install gettext first: brew install gettext see: Forcing bash to expand variables in a string loaded from a file

${1:+”$@”} in /bin/sh

‘Hysterical Raisins’, aka Historical Reasons. The explanation from JesperE (or the Bash man page on shell parameter expansion) is accurate for what it does: If $1 exists and is not an empty string, then substitute the quoted list of arguments. Once upon 20 or so years ago, some broken minor variants of the Bourne Shell … Read more

What does $- mean in Bash?

$- prints The current set of options in your current shell. himBH means following options are enabled: H – histexpand: when history expansion is enabled m – monitor: when job control is enabled h – hashall: Locate and remember (hash) commands as they are looked up for execution B – braceexpand: when brace expansion is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)