'script' command exits immediately


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 'script' command exits immediately
# 1  
Old 04-18-2011
'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type any commands or hit ctrl+D.

Anyone know how/why this could happen?

Thanks in advance for any help you can provide.
# 2  
Old 04-18-2011
What does
Code:
which script

show
# 3  
Old 04-18-2011
'which script' shows that /usr/bin/script is running. BTW, I didn't mention before, this is Solaris 8.

---------- Post updated at 08:21 PM ---------- Previous update was at 08:03 PM ----------

I am trying to login to a router from my server & get a screen capture of some output. I used a workaround of "(ssh router) 2>&1 | tee /tmp/output.txt" which seems to work, but I'm still curious why 'script' was exiting immediately.
# 4  
Old 04-18-2011
Quote:
Originally Posted by jalburger
'which script' shows that /usr/bin/script is running.
It shows that it's running? Er, what does it actually show? Copy-paste the result.
# 5  
Old 04-18-2011
=>which script
/usr/bin/script
=>
# 6  
Old 04-19-2011
Before starting "script":
Code:
echo $SHELL
tty

If $SHELL is not a valid shell that might be you problem.
If tty replies "not a tty" , that is your problem.
# 7  
Old 04-19-2011
AHA! $SHELL was set to /usr/bin/no_shell.ksh. Looks like it was an attempt at security by another user. It was doing some user validation before running /usr/bin/ksh. I set SHELL=/usr/bin/ksh and 'script' works as expected.

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script to compare file all the files exits or not

Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies

2. UNIX for Beginners Questions & Answers

Script to check if files exits

Hi In live system core files are generating frequently. around 10 core files in 30 mins in root file system. which is eating my space very much below is core file core.56539 core.78886 core.12302 core.80554 core.20147 I am trying to write a script which should move... (7 Replies)
Discussion started by: scriptor
7 Replies

3. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

4. Shell Programming and Scripting

Ssh bash script exits without remote command completion

Hi, My goal is to connect from unix server A to windows server B and call a bat file on windows. I am able to succeed in remoting to windows and executing a command, the issue i am facing is the shell scrip is exiting without making sure of bat file success. Can you please help me in... (4 Replies)
Discussion started by: pxp018
4 Replies

5. Shell Programming and Scripting

Execute a command after ssh exits

In my .tcshrc I define and run an alias to set my terminal title. The title contains the hostname. I do this because I ssh to other machines a lot and I always need to know which host I am typing in. The alias is defined and run in the .tcshrc like this... alias tt 'echo -n "^0;`hostname -s`^G"'... (5 Replies)
Discussion started by: salvadorjoshua
5 Replies

6. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

7. AIX

Getting size of all the luns immediately via script

Hi I know that to see the size of the lun I need to give the command as "bootinfo -s hdisk*" Can any one assist me with a script which if run will get the size of all the luns allocated to the server. The output of the script should be something like the one below : hdisk0 size = 24GB... (2 Replies)
Discussion started by: samsungsamsung
2 Replies

8. Shell Programming and Scripting

how to run a command as soon as user exits from session

I need to write a script, where I have to get names of files that are to be deleted from a user and have to delete those files when he exits session. How to set a particular command to be run as soon as user exits from a session? Can somebody help? I have to write a script on linux system.... (3 Replies)
Discussion started by: yashashri
3 Replies

9. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

10. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies
Login or Register to Ask a Question