[Novalug] Appending commands to a shell script file

John Place jplace@unixsage.com
Fri Mar 1 08:37:22 EST 2013


Removing the backticks will mean it is not in the output file, which I
think is the goal... Wrap in single quotes...


echo 'YMD=`date +"%Y%m%d"`' >> SomeFile


Thanks
John


On 03/01/2013 07:46 AM, Matt Rowley wrote:
> Remove the backticks. 
>
>
> On Mar 1, 2013, at 7:33 AM, Tony Jones <tjones12305@gmail.com> wrote:
>
>> Hi,
>>
>> I want to create a shell script that appends the output to a file using the echo statement.  I want to append the below to a shell script file - testfile.sh  This is just an example, but is close to what I want to accomplish.  However, when I execute the script in debug mode the output of YMD is the actual date or YMD=20130301.  My question is how to append the string with the date command to a file without executing the date command? In other words,  I want the file testfile.sh to have the line YMD=`date +"%Y%m%d"` and not YMD=20130301.  I know this is a strange way to do this.




More information about the Novalug mailing list