Solved

sh syntax

Posted on 2001-06-19
3
289 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now