by Vivek Gite on January 20, 2012 · 1 comment
I‘m using the date +’%D_%T’ to store Unix system date and time in a shell variable called $_now:
_now=”$(date +’%D_%T’)”
echo $_now
Outputs:
01/20/12_16:10:42
I’d like to replace / and : with _. I’m aware of the following sed command:
sed ‘s/\//_/g
> s/:/_/g’ <<<"$_now"
Outputs:
01_20_12_16_14_09
How do I specify two pattern within the same sed command to replace | and : with _ so that I can get output as 01_20_12_16_10_42?
How do I use the bash C style for loop under UNIX or Linux operating systems?
How do I run “foo” command 10 times (or n times) under Linux or UNIX like operating systems?
How do I auto Logout my shell user in Linux after certain minutes of inactivity?
I have a file of that looks as follows:
foo bar
tom jerry
UNIX Linux
Each word and/or Linux is a different length. How do strip or remove the last character from each line using bash or ksh shell only?
How do I change the default home page with Lynx browser under UNIX or Linux operating system? How do I set the startup page to http://google.co.uk with Lynx?
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?