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 )

I would like to see the Time-to-live (TTL) value for a ‘AAAA’ and A record for domains. How do I see Time-to-live (TTL) for a DNS record under Unix or Linux operating systems using command line options?

{ 3 comments }

I am a new Linux user. I have text files with lots of empty lines. How do I delete all empty lines under Linux or Unix operating systems?

{ 3 comments }

How do I match dot files under Unix / Linux using bash shell? Why .* considered as harmful when matching dot files under bash shell?

{ 5 comments }

I am a new Unix user. How do I rm (remove) all files in a directory called personal-files under Unix like operating systems?

{ 3 comments }

How do I find out number of arguments passed to my bash function called foo() under Unix like operating systems?

{ 1 comment }

How do I check if a directory exists in a shell script under Linux or Unix like operating systems?

{ 3 comments }

I need to parse the following text file:

# example.net config
user = www30021
group = ftp30020
uid = 30021
gid = 30020
tmp_path = /netapp42/shared/www/images/host.example.com/tmp.bin
tmp_perms = defaults,nodev,nosuid,noexec
jail = on
location = /jails/apache/h/host.example.com/
sftp = on
ftps = off
php-cgi = on
perl-cgi = off

I need to find out value for each field and remove any blank spaces / white spaces from the field. How do I solve this problem using awk under Linux or Unix like operating systems?

{ 6 comments }