Problems with 'for' in bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problems with 'for' in bash
# 1  
Old 08-27-2013
Problems with 'for' in bash

I am trying to run this small script but I got some errors
Code:
#!/bin/sh

set event_list = "17 20 21"

for event in `($event_list)`
echo Evento $event - Tarro
end

Thank you so much!!!
# 2  
Old 08-27-2013
This might work
Code:
for event in $(echo $event_list)

# 3  
Old 08-27-2013
if you use for loop then you need to stick to its syntax:
Code:
#!/bin/sh

export event_list="17 20 21"

for event in $event_list
do
   echo Evento $event - Tarro
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed problems - Bash Script

Hi I keep getting the following error sed: -e expression #1, char 32: unterminated `s' command sed: -e expression #1, char 35: unterminated `s' command sed: -e expression #1, char 35: unterminated `s' command whenever I use the following bash script #! /bin/bash... (2 Replies)
Discussion started by: spbr
2 Replies

2. UNIX for Dummies Questions & Answers

Bash with problems related to files

Hi unix people, i'm really a newbie and i've created a small bash to process some picture with ImageMagick. I have just some issue and i think this script, if we can help me to correct in right way, could be useful! Basically i have a Eyefi Card who puts files into a folder called "picture"... (1 Reply)
Discussion started by: riccardo
1 Replies

3. Shell Programming and Scripting

Problems with expect and sftp in bash

I'm having trouble with some automated sftp pulls. I'm using expect inside bash scripts and spawning SFTP. Some times the expect seems bog down. I have tried to put sleeps in my code to give everything time to work before I move on to next step but I till continue to get issues. For example when... (2 Replies)
Discussion started by: gosteen
2 Replies

4. Homework & Coursework Questions

bash error checking problems[solved]

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to make a script called showtime that displays the current time for a given city. The problem is on... (6 Replies)
Discussion started by: kevin298
6 Replies

5. Shell Programming and Scripting

Execution Problems with bash script

Hello, can someone please help me to fix this script, I have a 2 files, one file has hostname information and second file has console information of the hosts in each line, I have written a script which actually reads each line in hostname file and should grep in the console file and paste the... (8 Replies)
Discussion started by: bobby320
8 Replies

6. Shell Programming and Scripting

[BASH/SH] Regex/Rematching Problems

Hi anyone, since Sunday I try to create a schellscript that reads the last 10 lines of text out of a log and parses the guid's of the entrys in there. The log looks like this: ClienUserinfo: ... \cl_guid\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\...i tried to parse it like this: for line in $(tail -n 10... (18 Replies)
Discussion started by: s0lll0s
18 Replies

7. Shell Programming and Scripting

Beginner bash scripting - a few problems

Hey Guys, I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
Discussion started by: traxy
1 Replies

8. Shell Programming and Scripting

unzip via bash startup script problems

i have two lines in my rc.local file that are wget -O/<path>/<file>.zip url://domain.com unzip -o /<path>/<file>.zip the wget works fine, but the unzip won't work. when i copy/pase the unzip line to the prompt it works fine. i thought that maybe the unzip was running before the wget... (0 Replies)
Discussion started by: easysnowboards
0 Replies

9. Shell Programming and Scripting

cd problems in bash

Hi, I'm having problems with the "cd" command in bash not changing directories. From what I've read, I've gathered that scripts are child processes and can't change the directory of their parent process. How do I get around this problem? Thanks, Eric (2 Replies)
Discussion started by: Kweekwom
2 Replies

10. UNIX for Dummies Questions & Answers

problems with bash

Hi. I'm really a newbie trying to make my new Mac (OS 10.3) run some science programs under the X11 environment. I have been trying to install GDE2.2. In short, after several attempts I came to the URL http://www.mutatedmonkeys.com/factslog/archives/000830.html. And I thought that was my lucky... (0 Replies)
Discussion started by: tribu13
0 Replies
Login or Register to Ask a Question