venkatsr
asked on
C shell
Greetings,
I'm looking for an equivalent to $- in ksh to something in CSH, which shows if its interactive or not.
$?prompt is a similar functionality..but it works in both cmd line and in a script. ..this is so that certain actions can be taken when run from a script, such as the stty cmd. Because stty complains whe it's run from a non-interactive setting.
Anybody ?
I'm looking for an equivalent to $- in ksh to something in CSH, which shows if its interactive or not.
$?prompt is a similar functionality..but it works in both cmd line and in a script. ..this is so that certain actions can be taken when run from a script, such as the stty cmd. Because stty complains whe it's run from a non-interactive setting.
Anybody ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Venkastr
You can try testing for "TERM" and "TTY" being set, if neither is set then shell is unlikely to be running from a terminal. Not conclusive but has advantage it works over all Unix versions and all shells.
You can try testing for "TERM" and "TTY" being set, if neither is set then shell is unlikely to be running from a terminal. Not conclusive but has advantage it works over all Unix versions and all shells.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Answered by ahoffmann
Please leave any comments here before 13/1/2003
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster (I don't work here, I'm just an Expert :-)
I will leave a recommendation in the Cleanup topic area that this question is:
- Answered by ahoffmann
Please leave any comments here before 13/1/2003
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster (I don't work here, I'm just an Expert :-)
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
have you heard about $argv[1] , $argv[2] etc ...
it's not so clear in your qustion , but I assume that was
your wish .
in a c-sh script , you can use the argumentS given by the script your with : $argv[i] , i= num of argument
$#argv = returns the number of arguments supplied .
Tal