Posted on April 30th, 2008 by linux
Using a bash command “set” we can prevent bash redirection to overwrite existing files. If the file bash.txt exist this command will overwrite it:
ls > bash.txt
To prevent it we can run command:
set -C
to disable run command:
set +o noclobber
Example:
$ ls > bash.txt
$ set -C
$ ls > bash.txt
bash: bash.txt: cannot overwrite existing file
$ [...]
Filed under: Bash, Linux, Scripting | No Comments »
Posted on February 21st, 2008 by linux
There is a simple trick how to round floating point numbers within bash script. I’m sure that there are other ways how to round floating point number in bash, if you know other way let me know :
#!/bin/bash
# obtain floating point number
floating_point_number=`echo “2153.6 * 0.98″ | bc`
echo $floating_point_number
# get rounded number
for rounded_number in $(printf %.0f [...]
Filed under: Administration, Bash, Linux, Scripting | No Comments »
Posted on February 1st, 2008 by linux
This link can be very useful for someone starting with Linux administration. This guide / tutorial covers all basic Linux commands and examples on command line using bash shell ( BASH ). It can also be use as a Linux command reference.
Linux Commands
enjoy your Linux commands training ..
Filed under: Administration, Bash, Commands, Linux | No Comments »