More Bash 4 features I need to remember

26 01 2011

Found a 4 part article on Bash 4 on LinuxCommand.org Blog Site. Read a few more things that I really need to remember.

I am totally going to swipe their code….
1) New way of reading files
# Old way
while read line
array[i]="$line"
i=$((i + 1))
done < file
#New way
mapfile array < file

2) Just visit the website and read up part 3 on the ‘read’ command
In short, you can now supply default text in the read command.
read -e -p "What is your user name? " -i $USER

Thats all for now. I am sure I will find more new tidbits soon.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: