envsubst: command not found on Mac OS X 10.8
brew install gettext brew link –force gettext This will enable envsubst on OS X, and force it to link properly. It requires homebrew to be installed.
brew install gettext brew link –force gettext This will enable envsubst on OS X, and force it to link properly. It requires homebrew to be installed.
Great question. I use a pattern like this for most of my scripts: #!/bin/bash main() { foo bar baz } foo() { } bar() { } baz() { } main “$@” You can read the code from top to bottom, but it doesn’t actually start executing until the last line. By passing “$@” to main() … Read more
Be sure to give it the execution permission. cd ~/the/script/folder chmod +x ./startup.sh This will give exec permission to user, group and other, so beware of possible security issues. To restrict permission to a single access class, you can use: chmod u+x ./startup.sh This will grant exec permission only to user For reference
What is a file with extension .sh? It is a Bourne shell script. They are used in many variations of UNIX-like operating systems. They have no “language” and are interpreted by your shell (interpreter of terminal commands) or if the first line is in the form #!/path/to/interpreter they will use that particular interpreter. Your file … Read more
Yeah, yeah, the question is over a year old, but maybe I can add something useful: How to cron something at a random offset 20 times a day between 9am and 11pm? That’s kinda tricky within cron, because you are dividing 14 hours by 20 execution times. I don’t like the other answers very much … Read more
sed: sed ‘5!d’ file awk: awk ‘NR==5’ file
In all of the cases above, the variable is correctly set, but not correctly read! The right way is to use double quotes when referencing: echo “$var” This gives the expected value in all the examples given. Always quote variable references! Why? When a variable is unquoted, it will: Undergo field splitting where the value … Read more
Install GIT. During installation of GIT, add GIT Bash to windows context menu by selecting its option. After installation right click in your folder select GIT Bash Here (see attached pic) and use your sh command like for example: sh test.sh
Probably the most efficient method, if you’re using the bash shell (and you appear to be, based on your comments), is to use the sub-string variant of parameter expansion: pax> long=”USCAGol.blah.blah.blah” pax> short=”${long:0:2}” ; echo “${short}” US This will set short to be the first two characters of long. If long is shorter than two … Read more
You just execute: export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games that would be for the current session, if you want to change permanently add it to any .bashrc, bash.bashrc, /etc/profile – whatever fits your system and user needs. Note: This is for Linux. We’ll make this clear for new coders. (` , ‘) Don’t try to SET = these.