script -a filename


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script -a filename
# 1  
Old 09-11-2006
script -a filename

Dear All,

I have a small question but the answer might not be small Smilie

I am using the following command "script -a filename" to record commands executed by user.
As you know, the above command will print all what appears on the screen (commands and their output) to the filename.

Is there a way, to print to the filename only the commands without the output of these commands???

Appreciate your help.
# 2  
Old 09-11-2006
well u have .sh_history file.
# 3  
Old 09-11-2006
.history file names may differ depending on your shell (e.g. .bash_history)
# 4  
Old 09-17-2006
I understand what you have said but the .sh_history stores all commands entered by all users (i.e. its the shell history and not the user history). What i am looking for here is the user history.

The command i have mentioned eralier ( script -a filename) stores all the commands entered by the user who have looged into the system and the utput file which includes these commands will be saved once the session is terminated ot user logged out. The problem is that the above command will print the commands entered by the user along with their output, what i want to have is a file having only the commands (i.e. without the result of executing those commands)....

Anyone can help with this????
# 5  
Old 09-17-2006
then you could turn on accounting instead, and then use the last or lastcomm commands to display commands entered by user. script -a is probably not the correct tool for your requirement
# 6  
Old 09-17-2006
Quote:
Originally Posted by charbel
I understand what you have said but the .sh_history stores all commands entered by all users (i.e. its the shell history and not the user history). What i am looking for here is the user history.
.*_history files are stored in user's home folder for each user not for all
# 7  
Old 09-18-2006
I agree with u that the .*_history stores the command for each user in their home directory. But what if i have 2 users having the same home directory, then how to distniguish shish user have enetered which commands (i.e. the .*_history will then be the history file for both users and not only for one of them since both having the same shell and the same home directory).

Any idea about this?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX script to display the filename

Hi All How to answer the below interview question.. With a path and filename of "/mydir1/mydir2/mydir3/myfilenane.dat" write a UNIX script to display the filename (2 Replies)
Discussion started by: shumail
2 Replies

2. Shell Programming and Scripting

Script to locate date in filename

I am looking for a way to find a date in the file without using find. for example something like this: files=`ls |grep txt` YEST=`TZ="GMT+24" date +'%m-%d-%Y'|sed 's/^0//g' |sed 's/$/.txt/g'` YES1=`TZ="GMT+48" date +'%m-%d-%Y'|sed 's/^0//g' |sed 's/$/.txt/g'` if ]; then echo yes;else echo... (4 Replies)
Discussion started by: newbie2010
4 Replies

3. Shell Programming and Scripting

Need script to cut string from a filename

Hi, I need a script which do below I have a filename: TEST2013_09_17_XX_XX_XX.csv Now script should create a new file with name: XX_XX_XX.csv Or I should say i need the output as XX_XX_XX.csv Please help. Mant thanks in advance (3 Replies)
Discussion started by: sv0081493
3 Replies

4. Shell Programming and Scripting

Shell script if [[ -L <filename> ]]

Hi Please describe about following condition if ] in shell script. Also please provide the link related all the flags which are applicable for if condition in Shell (4 Replies)
Discussion started by: munna_dude
4 Replies

5. Shell Programming and Scripting

filename in the script as input

Hey guys, I have a list of urls which I want to download and analyze with bash and lynx, I'm using this codefor each url: downloader.sh: #!/bin/bash lynx -source http://domain.com/product.php?e=123456 > 123456.html lynx -dump 123456.html > 1234567.dat cat 123456.html | grep -A 1... (1 Reply)
Discussion started by: Johanni
1 Replies

6. Shell Programming and Scripting

Help with printing the calling script filename

Consider the following sample scripts..... filename: f1 # Call f3 f3 filename: f2 # Call f3 f3 filename: f3 # f3 echo "$x called me" (2 Replies)
Discussion started by: frozensmilz
2 Replies

7. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

8. UNIX for Dummies Questions & Answers

script takes the whole filename instead of just extension

I am running my script from "/abc/" this path and it has no ".csv files" but has a ".txt" files namely temp1.txt My script goes as below, wherein it is suppose to find files with *.txt extension and *.csv extension in another path namely "/abc/xyz/": #!/bin/ksh PATH1="/abc/xyz/" value="*.csv... (1 Reply)
Discussion started by: wolverine999
1 Replies

9. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

10. Shell Programming and Scripting

Passing Filename as a Parameter to Another script

Hi, I have a requirement to write a script file(script1.sh) to read the file from the folder say /usr1/profiles/active and pass the file name as a parameter to another script file say (script2.sh) which would subsitute this parameter. The script2.sh will have a line like the one below ... (1 Reply)
Discussion started by: ravisg
1 Replies
Login or Register to Ask a Question