Append text to file
To append all contents of textfile1.txt to the end of textfile2.txt: $> cat textfile1.txt >> textfile2.txt or to add text directly to the end of the file, you can use: $> echo “TEST” >> testfile.txt
To append all contents of textfile1.txt to the end of textfile2.txt: $> cat textfile1.txt >> textfile2.txt or to add text directly to the end of the file, you can use: $> echo “TEST” >> testfile.txt
This is how to create associative arrays (hash, dictionary) on bash: #!/bin/bash if [ “$1” == “help” ] then echo “Help”; echo “USAGE:”; echo “========”; echo “purge_landingpage_varnish.sh LIVE|STAGE”; exit 0; elif [ $1 ] then DOMAINS[‘LIVE’]=”www.ask-sheldon.com”; DOMAINS[‘STAGE’]=”stage.ask-sheldon.com; REQUEST_DOMAIN=””; if [ “$1” == “LIVE” -o “$1” == “STAGE” ] then REQUEST_DOMAIN=${DOMAINS[“$1”]}; else echo “You have to give […]
#Copy something from this system to some other system: $> scp /path/to/local/file username@hostname:/path/to/remote/file  #Copy something from some system to some other system: $> scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file  #Copy something from another system to this system: $> scp username@hostname:/path/to/remote/file /path/to/local/file You can add a port with the -P param You can do it recursive with […]
$> sed -i ‘s/old-word/new-word/g’ file
With tar On Unix based plattforms you can use the tar command for file compression and also for later uncompression. Compression $> tar -pczf web.tar.gz web/ With -h as the first parameter the real files instead symbolic links are compressed. So you can tar symbolic link targets. To exclude files or folder, you can define –exclude=’fileOFolderPath’ directly […]