Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to check the user input from terminal Post 302263046 by npatwardhan on Sunday 30th of November 2008 12:21:35 PM
Old 11-30-2008
if i understand you right, try this

Code:
#!/usr/bin/bash
echo -n 'Enter the file name to delete:'
read c
echo "c is $c"
echo 'Delete c (y/n)?'
read yesOrNo
if [ $yesOrNo = 'y' ]
then
rm $c
echo $c deleted
else
echo $c not deleted!
fi

this will save the file name you entered into a variable c and then remove that file..
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

Is my terminal input secure?

My knowledge of Unix input/output/devices is very hazy so could someone please tell me if the following is secure? I log on to an account on a shared Unix server (Linux 2.6.18-6-686) using ssh (PuTTY). I start a python program and then type into it (python raw_input command) the... (2 Replies)
Discussion started by: pnp
2 Replies

2. Shell Programming and Scripting

Bash : how do i check the user input and make sure is only chracter or only number ?

Bash : how do i check the user input and make sure is only character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies

3. 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

4. Homework & Coursework Questions

Function to Check if string input from user is alphabetic only

Good Evening. I'm new to C. Can you please help me. I'm creating an error checking function, user will input a string, this will check if the input is all alphabet or all letters only. If there is a digit or other special char, it will print Error then ask input from user again. Here's my... (1 Reply)
Discussion started by: eracav
1 Replies

5. Shell Programming and Scripting

Check user input

Hi, I need my script to check if the user enters 3 values if not 5 values to my script and alert if the input has any other number of values. for example: ./myscript.sh 22 56 3221 - > correct ./myscript.sh 22 56 3221 45 777 -> correct ./myscript.sh 22 56 3221 45 -> incorrect Please... (6 Replies)
Discussion started by: mohtashims
6 Replies

6. Shell Programming and Scripting

How-To Check & Filter user input

Hi, On my Java webpage which invokes the shell script has two checkboxes viz ... apache and weblogic apache require one parameter i.e apache home from the user while Weblogic requires three or five params from the user vi.z weblogic_home or <jdk_home, config_home & pid>, username and... (4 Replies)
Discussion started by: mohtashims
4 Replies

7. Shell Programming and Scripting

How to check the user input to be valid using shell script?

How to check the user input to be valid using shell script? The valid input is in the format like as follows. 1. It can only have r,w,x or a hyphen and nothing else. 2. ensure the r, w, x are in the correct order. for example: rwxr-xr-x is a valid format. Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies

8. 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

9. What is on Your Mind?

Should we use CODE Tags for terminal input and output?

I've always used code tags for code but not for showing terminal input and output. I noticed a mod edited one of my threads and now I'm confused as to proper protocol. Mike (5 Replies)
Discussion started by: Michael Stora
5 Replies

10. Shell Programming and Scripting

Would like to check user input for letters within a loop

Hi All, #!/bin/bash #Just trying to check if letters are in the user input. Any tips? # I have tried regexp and using 0-9 etc, i cannot get this to work either in just an if statement or while in a loop. echo "Please pick a number" read num if ; then echo "Please enter a number"... (7 Replies)
Discussion started by: jvezinat
7 Replies
talk(1) 						      General Commands Manual							   talk(1)

NAME
talk - talk to another user SYNOPSIS
talk_party [ttyname] DESCRIPTION
The utility is a two-way, screen-oriented communication program. The command argument talk_party can take one the following forms: user where user is a login name and host is a host name. The optional command argument, ttyname, can be used to specify the terminal to be used when contacting a user who is logged in more than once. In absence of this argument, will try to contact the user on the user's most recently used terminal. When first invoked, sends the following message to the party it tries to connect to (callee): ... At this point, the recipient of the message can reply by typing: Once communication is established, the two parties can type simultaneously, with their output displayed in separate regions of the screen. Characters are processed as follows: o Typing characters from LC_CTYPE classifications print or space will cause those characters to be sent to the recipient's terminal. o Typing <control>-L will cause the sender's screen to be refreshed. o Typing the erase, kill or kill word character will delete the last character, line or word on the sender's terminal, with the action propagated to the recipient's terminal. o Typing the interrupt character will terminate the local talk utility. Once the talk session has been terminated on one side, the other side of the talk session will be notified that the session has been terminated and will be able to do nothing except exit. o Other non-printable characters typed on the sender's terminal are converted to printable characters before they are sent to the recipi- ent's terminal. Permission to be a recipient of a message can be denied or granted by using the utility. However, a user may need other privileges to be able to access other users' terminals. The utility will fail when the user lacks the appropriate privileges. SEE ALSO
mesg(1), who(1), write(1). STANDARDS CONFORMANCE
talk(1)
All times are GMT -4. The time now is 01:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy