Bash

From wiki.vincentkong.com
Jump to: navigation, search

Contents

Setting environment variable

$ export PATH=$PATH:/home/username/bin
$ echo $PATH

If statement

Test if file exist

if [ -a FILE ]
then
    echo "File exist."
fi

Paper icon.png Reference: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

Read a file line by line

#!/bin/bash

while read line   
do   
    echo -e "$line\n"
done < filename.txt  
Retrieved from "/wiki/Bash"
Personal tools
MY WEBSITES