Identifier in shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Identifier in shell
# 1  
Old 06-28-2012
Identifier in shell

Dear guys I need help here with syntax, I am trying to start
Code:
script

command to capture all user activities every day, I want the log file of each user to be named with his login ID + date time to overcome the possibility of over writing the log file if he logoff and login again. Here is was I wrote in the .profile of each user.


Code:
TIMESTAMP=(date | nawk '{print $2 $3 $4}')
script /tmp/daily_activity/$LOGNAME.$TIMESTAMP.txt

it seems not working the problem here is with the TIMESTAMP syntax i guess, appreciated all the help

OS is Solaris 10
# 2  
Old 06-28-2012
Try this
Code:
TIMESTAMP=$(date '+%Y%m%d%H%M%S')

# 3  
Old 06-28-2012
you missed the $
Code:
TIMESTAMP=$(date | nawk '{print $2 $3 $4}')

# 4  
Old 06-28-2012
thanks for the help guys i tried both same error
Code:
-sh: syntax error: `TIMESTAMP=$' unexpected

# 5  
Old 06-28-2012
then, use back ticks

Code:
TIMESTAMP=`date | nawk '{print $2 $3 $4}'`

# 6  
Old 06-28-2012
thanks so much itkamaraj it works perfect.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Java Identifier

Hello All, Input: long_and_mnemonic_identifier anotherExample i bad_Style Output: longAndMnemonicIdentifier another_example i Error! Can someone help me in writing a script for the above ..Thanks and appreciated your help.. (1 Reply)
Discussion started by: bobby1015
1 Replies

2. Solaris

Is not a identifier error

Hi I am trying to execute a script. I have solaris 10, After i login i will toggle to BASH. The script tried to set a variable called CARBON_HOME. Even i tried to set it manually. But still it is saying the following error.:wall: " CARBON_HOME=/usr/wso2/wso2esb-4.0.0: is not an... (5 Replies)
Discussion started by: gnanagurus
5 Replies

3. UNIX for Advanced & Expert Users

ORACLE_SID= ...: is not an identifier

Hello All, On My solaris 5.10 SPARC, i am always having problems setting my Oracle variables. even if it exists in the .profile file. below is an example $ export ORACLE_SID=test ORACLE_SID=test: is not an identifier even that the echo is returning the variable $ echo $ORACLE_SID... (3 Replies)
Discussion started by: beayni33
3 Replies

4. Shell Programming and Scripting

is not an identifier

Hi Guys... I am using the following codes in my script: SID_L=`cat /var/opt/oracle/oratab|grep -v "^#"|cut -f1 -d: -s` SID_VAR=$SID_L for SID_RUN in $SID_VAR do ORACLE_HOME=`grep ^$SID_RUN /var/opt/oracle/oratab | \ awk -F: '{print $2}'` ;export ORACLE_HOME export... (2 Replies)
Discussion started by: Phuti
2 Replies

5. Shell Programming and Scripting

not an identifier

Hi I have already gone through this topic on this forum, but still i am getting same problem. I am using solaris 10. my login shell is /usr/bash i have got a script as below /home/gyan> cat 3.cm #!/usr/bin/ksh export PROG_NAME=rpaa001 if i run this script as below , it works fine... (3 Replies)
Discussion started by: gyanibaba
3 Replies

6. Shell Programming and Scripting

Identifier In Shell script

Hi, I have a shell script and inside that shell script it calls a local .env file to set the environment for the shell script ,but the thing is that i got a error while running the script like ./myscript.sh it gives DB_NAME=dvcl021: is not an identifier that DB_Name is accessed from my .env... (6 Replies)
Discussion started by: malickhat
6 Replies

7. Shell Programming and Scripting

shell script to find and replace a line using a identifier

Hi all im having trouble starting with a shell script, i hope someone here can help me i have 2 files file1: 404905.jpg 516167 404906.jpg 516168 404917.psd 516183 404947.pdf 516250 file2: 516250 /tmp/RecyclePoster18241.pdf 516167 /tmp/ReunionCardFINAL.jpg 516168... (7 Replies)
Discussion started by: kenray
7 Replies

8. Solaris

-sh: is not an identifier

Hi , I am getting the following message when log into my unix account in sun solaris (version5.9)server. -sh: ORACLE_HOME=/apps/oracle/product/10.2.0/client_1: is not an identifier The ORACLE_HOME is set in .profile file. Another thing is that SID is also set inside .profile like... (4 Replies)
Discussion started by: megh
4 Replies

9. UNIX for Dummies Questions & Answers

Shell Script Unique Identifier Question

i All I have scripting question. I have a file "out.txt" which is generated by another script the file contains the following my_identifier8859574 logout The number is generated in the script and I have put the my_identifier bit in front of it as a unique identifier I now have... (7 Replies)
Discussion started by: grahambo2005
7 Replies

10. Shell Programming and Scripting

Problem with shell script...ORA-00904:invalid identifier

Guys, Please suggest me what's wrong with this script? #!/usr/bin/sh ############################################################################## # Author : Bhagat Singh # # # Date : Nov 13,2006 #... (12 Replies)
Discussion started by: bhagat.singh-j
12 Replies
Login or Register to Ask a Question