tcsh and user input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting tcsh and user input
# 1  
Old 12-30-2008
tcsh and user input

Here is my script:

echo "var 1:"
read varone
echo "$varone"

When I run in via ksh the script runs successfully.

However when I run it via tcsh I get "varone: Undefine variable"

Does the name command not work with tcsh or do I need some additional modification? Is there a way to get the same done in tcsh rather than ksh (I am limited to writing my final script in tcsh).

Thank you.
# 2  
Old 12-31-2008
Quote:
Originally Posted by bonesy
Does the name command not work with tcsh or do I need some additional modification?
AFAIK Tcsh doesn't come with a 'read' command but the man page should tell you. Could try 'echo "var 1:" ; set varone=$<; echo $varone'?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

User input and run awk using the input

I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :). The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies

2. Shell Programming and Scripting

TCSH user input error checking

This was taken down recently because it appeared to be homework, but it isn't. It's for a script I am working on at work. Thanks for the help. How do you check that user inputs (arguments 1 and 2) are both numbers and are at least 5 digits in length? (2 Replies)
Discussion started by: thibodc
2 Replies

3. Shell Programming and Scripting

TCSH user input checks

I would like to check user input for arguments 1 and 2 for my Solaris TCSH script for the following: 1. That both user input arguments are numbers. 2. That they are both at least 5 digits. Thanks for the help. (1 Reply)
Discussion started by: thibodc
1 Replies

4. Shell Programming and Scripting

Script interacts with user , based on user input it operates

i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled. #!/bin/sh echo " Enter your choice to continue y/Y OR n/N to quit " read A if then echo " user requested to continue " ##some commands... (7 Replies)
Discussion started by: only4satish
7 Replies

5. Shell Programming and Scripting

How to get the user input recursively until the user provides valid input

Hi, echo "Enter file name of input file list along with absolute path : " read inputFileList if then for string in `cat inputFileList` do echo $string done else echo " file does not exist" fi From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies

6. Shell Programming and Scripting

how to prompt the user to enter an array in tcsh

Hello, I am writing a script that requires the user to enter a string of numbers: ex: 134 345 865 903 This command only allows for one variable to be entered: set "var" = $< and than once I got the array I want to change it to a list with each input on a different line: ... (1 Reply)
Discussion started by: smarones
1 Replies

7. UNIX for Advanced & Expert Users

Remote commands fail for tcsh user

I'm more familiar with bash/ksh that csh/tcsh. With that said, I recently ran across a problem with tcsh. Our system admin recently installed purify on our solaris 8 system. In order to use purify you have to execute a Rational script in order to setup the paths and some environment variables... (3 Replies)
Discussion started by: sszd
3 Replies

8. Shell Programming and Scripting

tcsh user failed to call library in ksh program

Hi folks, I'm trying to organize functions in my ksh program into libraries. If I run my program as any ksh user it will succeed. Only when I run my program as tcsh user (i.e oracle) I failed. Example ======= The ksh code: tornado:/tmp # cat nir.ksh #! /bin/ksh cdromPath=`pwd`... (1 Reply)
Discussion started by: nir_s
1 Replies

9. Shell Programming and Scripting

TCSH.need help.take input during a while/end loop

I am writting a script in csh and I am blanking out on how I code in the ability to process user input in the middle of a while/end loop. while(1) args.. end it is a simple script, and I want to add hotkey functions, like q to quit, z to zero counters, etc.. Google has not been very... (1 Reply)
Discussion started by: seg
1 Replies
Login or Register to Ask a Question