Solved

sh syntax

Posted on 2001-06-19
3
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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