Sponsored Content
Top Forums Shell Programming and Scripting redirect input within case statement? Post 302530147 by h8mmer on Monday 13th of June 2011 05:16:49 AM
Old 06-13-2011
redirect input within case statement?

I'm trying to run the logic below but get a `<' is not matched error message when I return a Y or y;

Code:
printf "Run this [Y/N]? : "
read RESP
case $RESP in
 Y|y)
    cat <<EOF > file
      today is Monday
    EOF ;;
 N|n)
     exit 1 ;;
esac

Any ideas?

Last edited by Scott; 06-13-2011 at 06:21 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case statement

Hi all, is it possible to create a 'dynamic' case statement. ie select option in `ls` do case satement depending on results of the above `ls` done I hope I have explained this ok! Thanks Helen (1 Reply)
Discussion started by: Bab00shka
1 Replies

2. Shell Programming and Scripting

Case Statement

Can anyone please tell me why this wont work! Thanks so much! #!/bin/sh for file do case $file in *.*.*) echo Cannot have more than 1 dot exit ;; *'**'*) echo Cannot have more than 1 asterisk exit ;; *'*'*|?.) echo this is a target (19 Replies)
Discussion started by: Zeta_Acosta
19 Replies

3. UNIX for Dummies Questions & Answers

How to redirect debug statement to file?

Hi, I need to redirect the debug statements to out.txt {(set -x) >> out.txt} ??? (1 Reply)
Discussion started by: redlotus72
1 Replies

4. Shell Programming and Scripting

case statement

hi all i'm writing a script and in it i need to prompt the user if the entered value is correct or not ,i wrote the following and its not working ,its executing the script even if i enter Y/N pls any help is appreciated echo "\nAre you sure you entered the right Destination Environment? y :... (5 Replies)
Discussion started by: bkan77
5 Replies

5. UNIX for Dummies Questions & Answers

If or Case Statement

I want to write a program with the following variables: a=7000 b=24000 c=613.8 The user can enter two words: Vivid or Blue for example. The challenge is that the user might not want to write the words the way they appear. The user can write V or v or vivid or Vivid or write Blue or blue, or B,... (1 Reply)
Discussion started by: Ernst
1 Replies

6. UNIX for Dummies Questions & Answers

CASE statement

Hi, I am writing a bash shell script. My script has a few user defined parameters. When the script runs the first thing it does is make sure that these parameters are valid. One of the parameters is called YEAR. A valid input for YEAR can be 1997-2000. One way I have come up with to ensure... (3 Replies)
Discussion started by: msb65
3 Replies

7. Shell Programming and Scripting

!!VERY URGENT!! Trouble in getting user input, while using under CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous... (1 Reply)
Discussion started by: s.deepak
1 Replies

8. Shell Programming and Scripting

Trouble in getting user input while using CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous menu... (4 Replies)
Discussion started by: s.deepak
4 Replies

9. Shell Programming and Scripting

Case Statement

Hey, guys I really need some help with a project. "Write a shell program that examines the command line arguments, counts and collects the number of options. Basically it has to collect and count the arguments that start with a "-" and the one's that don't start with a - I know I have to use... (2 Replies)
Discussion started by: sk192010`
2 Replies

10. Shell Programming and Scripting

Bash read input in case statement not working as expected

I'm having an issue with bash read input when using a case statement. The script halts and doesn't read the input on the first loop. if I hit enter then the scripts starts to respond as expected. Need some help here. defaultans=8hrs read -e -i $defaultans -p "${bldwht}How long would you like... (5 Replies)
Discussion started by: woodson2
5 Replies
SYSTEMD-CRYPTSETUP@.SERVICE(8)				    systemd-cryptsetup@.service 			    SYSTEMD-CRYPTSETUP@.SERVICE(8)

NAME
systemd-cryptsetup@.service, systemd-cryptsetup - Full disk decryption logic SYNOPSIS
systemd-cryptsetup@.service /usr/lib/systemd/systemd-cryptsetup DESCRIPTION
systemd-cryptsetup@.service is a service responsible for setting up encrypted block devices. It is instantiated for each device that requires decryption for access. systemd-cryptsetup@.service will ask for hard disk passwords via the password agent logic[1], in order to query the user for the password using the right mechanism at boot and during runtime. At early boot and when the system manager configuration is reloaded this /etc/crypttab is translated into systemd-cryptsetup@.service units by systemd-cryptsetup-generator(8). SEE ALSO
systemd(1), systemd-cryptsetup-generator(8), crypttab(5), cryptsetup(8) NOTES
1. password agent logic http://www.freedesktop.org/wiki/Software/systemd/PasswordAgents systemd 208 SYSTEMD-CRYPTSETUP@.SERVICE(8)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy