Solved

sh syntax

Posted on 2001-06-19
3
294 Views
Last Modified: 2013-12-16
I am getting a script (in *unix) to output to file using the following:
 
/usr/local/bpc/bids2login -l <username> -f /etc/bpc.login.pw 2>&1 > <log> &
 
where log is of course the specified name of the log file... Now here's the question.. say I want the log file name to be date stamped.. so the log file name would end up being, for example, bids2login02030.log..  how would I modify the above command line to do that? I tried reading the sh man but its in typical unix speak :)
 
Thanks.
0
Comment
Question by:missy041598
  • 2
3 Comments
 
LVL 5

Expert Comment

by:garboua
ID: 6208039
use date command logFileName'date+"%d%m%y"'
this will name the file logFileName190601
for more options on the date comment just do a man date
0
 

Author Comment

by:missy041598
ID: 6208683
Would you be able to provide me with the new command I should use incorporating the above.
0
 
LVL 5

Accepted Solution

by:
garboua earned 50 total points
ID: 6208854
/usr/local/bpc/bids2login -l <username> - /etc/bpc.login.pw 2>&1 > bids2login`date+"%d%m%y"`
notice there are not single quotes, ticks, it the back-tick, located in the same button as the tilde ~, it tells the shell to execute the command first and then produce the string, so your system will resolv date+"%d%m%y" as 200601 then your log will be bids2login200601
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question