≡ Menu

bash shell script

Bash Script: Find Out In What Directory Script Is Stored Under Unix Or Linux

How can I find out the path of the directory in which my bash shell script is located and store that path in _base variable?
[click to continue…]

Bash / KSH: Define Delimiter (IFS) While Using read Command

How do I can set IFS (internal field separator) while using read command in bash loops?
[click to continue…]

HowTo: Reverse a String In Unix / Linux Shell?

How do I reverse lines of a file or files under Linux or Unix like operating systems?
[click to continue…]

Linux / UNIX: Bash Script Sleep or Delay a Specified Amount of Time

How do I pause for 5 seconds or 2 minutes in my bash shell script on a Linux or Unix-like systems?
[click to continue…]

Linux / UNIX: Command For Executing a Shell Script

How do I execute a script under UNIX or Linux like operating system using command prompt?
[click to continue…]

Bash Shell Find Out If A Command Exists On UNIX / Linux System ($PATH) OR Not

I want find out if a command exists on UNIX from a bash shell script. If command does not exists in $PATH, then I would like to display an error message on screen. How do I find out if a command exists on Posix system or not?
[click to continue…]

Bash Script: Read One Character At A Time

I need to count one character at a time from input.txt. How do I read one character at a time under Linux / UNIX bash shell script?
[click to continue…]

Bash Shell Script Function Examples

How do I create a shell script function using Bash under UNIX / Linux operating systems?
[click to continue…]

Bash Get All Command Line Arguments Before Last Parameter In $@

I'm writing a wrapper bash shell script that will get the last argument (a domain name) from the command line into a shell variable called $_domain. I need to find all other parameters before last parameter in $@ and stored in a shell variable called $allargs. So that I can pass them as follows:

/path/to/real/binary "$allargs" "$_domain"

How do I do this using bash shell under Unix like operating systems?
[click to continue…]

Save Bash Shell Script Output To a File

How do I save my bash shell script output to a file?
[click to continue…]