How to make a cshell (csh) script interactive


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to make a cshell (csh) script interactive
# 1  
Old 09-06-2005
How to make a cshell (csh) script interactive

Experts,

I tried to make my cshell script interactive by asking the user for password and trying to read the input using the "read" command. I have been unsuccessful so far. Do you have any idea ?

Thanks

Jim
# 2  
Old 09-07-2005
Code:
#!/bin/csh -f
stty -echo
echo -n "Password: "
set pword=$<
stty echo
echo ""
echo "You typed $pword"

# 3  
Old 09-07-2005
Thanks a ton!!! I never expected it to be so easy. Anyways easy things are often hard. Thanks once again.

Jim
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help make pkgadd command Non-Interactive

i use this command to make pkgadd non-interactive. Command1: echo | sudo /usr/sbin/pkgadd -n -a /u/base/admin -r silent.txt -d /tmp/dbs.pkgThis works fine if i run it as root user but when i run it with non-root user it prompts me for the password and then executes successfully thus making it... (9 Replies)
Discussion started by: mohtashims
9 Replies

2. Shell Programming and Scripting

How to make command line interactive?

I have a file with stats for different month, I use the cat and grep combination to search for different month. cat <file> | grep "April" cat <file> | grep "May" cat <file> | grep "June" etc. How do you make this command interactive. So that I can give the values for the search. Thanks... (7 Replies)
Discussion started by: purelltab
7 Replies

3. Shell Programming and Scripting

Script cShell - help!!

Hello everyone! i'm new in this forum and I'm here because I have a huge problem with a csh script. Here the problem: I have to write a script that check the system status, more precisely I have to check if there are processes with TIME > 3 hours and if such processes exists I must send a mail... (3 Replies)
Discussion started by: TheBeefEater
3 Replies

4. Homework & Coursework Questions

How to write script that behaves both in interactive and non interactive mode

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (8 Replies)
Discussion started by: rits
8 Replies

5. Homework & Coursework Questions

Help with Interactive / Non Interactive Shell script

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (1 Reply)
Discussion started by: rits
1 Replies

6. Shell Programming and Scripting

Help make a program in cshell that searches and prints in a specific format

say I have a file named phones in that file every line is like that lastname^firstname^phone how can I make a program in cshell that searches for a specific string in phones and echos the result (if found) like that: lastname1 firstname1 phone1 ------------------ lastname2 firstname2... (8 Replies)
Discussion started by: h4wk
8 Replies

7. Shell Programming and Scripting

How to make interactive shell script a automated one?

Hi, I am new to shell scripting.I have written a very simple shell scipt that asks for the username and password on executing. i.e echo "Enter username :" read usrname; echol "Enter password :"; read passwd; echo usrname; echo passwd; but now I want to make it automatic , such... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

8. Shell Programming and Scripting

how to make your bash script run on a machine with csh and bash

hi, i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Discussion started by: npatwardhan
3 Replies

9. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

10. Shell Programming and Scripting

Is there any way to make up arrow show last command in CSh?

Hi, I've been looking for a way to make the up arrow show the last command in csh, like how it does in bash/ksh. I've been googling and just can't find anything.....anybody have any ideas? thanks! (5 Replies)
Discussion started by: sayeo
5 Replies
Login or Register to Ask a Question