≡ Menu

Bash Shell Programming HowTos

Tutorials, howtos and programming tips about GNU Bourne-Again SHell (BASH) for Apple OS X, Linux, *BSD and Unix like operating systems. ( rss feed )

Linux / UNIX: Run Commands When You Log Out

I've written a Perl script that connects to our central server for me and it allows me feed data so that I make a timesheet later. How do I run my script when I log out from Apple OS X or Linux / UNIX workstation using bash shell?
[click to continue…]

Linux: Bash Get Time

How do I get the system time in BASH? How can I get the Linux system using bash shell?
[click to continue…]

Debian Linux Delete Directory Command

I am new to Debian Linux and bash shell command line. How do I delete or remove a directory using bash prompt?
[click to continue…]

What is the use of UNIX source command under bash or any other shell? How do I use source command under UNIX / OS X / Linux operating systems?
[click to continue…]

Bash Shell Generate Random Numbers

How do I create or generate random numbers (sequence of numbers that lack any pattern), under Bash shell?
[click to continue…]

How do I kill all the UNIX jobs I created under my current login shell such as Bash or KSH before logout?
[click to continue…]

Bash Shell Read a Line Field By Field

How do I read a file field-by-field under UNIX / Linux / BSD Bash shell? My sample input data file is as follows:

device1,deviceType,major,minor,permissions
device2,deviceType,major,minor,permissions
...
....
.
deviceN,deviceTypeN,major,minor,permissions

For each line I need to construct and execute a shell command as follows:
/path/to/deviceMaker --context=$1 -m $permissions $device2 $deviceType $major $minor
[click to continue…]