no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | tech:linux:bash_commands [2015/06/24 11:55] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Advanced bash scripting ====== | ||
+ | http:// | ||
+ | |||
+ | ====== Bash Commands ====== | ||
+ | |||
+ | ===== Finding a size of a file ===== | ||
+ | <code bash> | ||
+ | file_size=$(stat -c%s " | ||
+ | </ | ||
+ | |||
+ | ===== Wait for user to strike a key ===== | ||
+ | <code bash> | ||
+ | read -p "Press [Enter] key to start backup..." | ||
+ | </ | ||
+ | |||
+ | ===== Filename from Filepath ===== | ||
+ | Extracting File Name with extension and without extension given full file path | ||
+ | <code bash> | ||
+ | filewithpath=/ | ||
+ | filename=$(basename $filewithpath) | ||
+ | filenoext=${filename%%.*} | ||
+ | </ | ||
+ | |||
+ | filename will have abc.txt | ||
+ | |||
+ | filenoext will have abc | ||
+ | |||
+ | |||