help with simple read script!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers help with simple read script!
# 1  
Old 03-27-2008
help with simple read script!

Hi y'all...I've been wracking my brain over this very simple script that reads in a textfile and echos each line. But I keep getting an error.
Below is my script:

#!/bin/bash

while read myline
do
echo $myline
done < t_file-20080221.01.asc

The error I am getting is:
syntax error near unexpected token `done'

Funny thing is if I just cut and paste the line directly into the command prompt, it works...HELP!

Cheers!
# 2  
Old 03-27-2008
Your code works for me. Smilie

Maybe you have an unprintable character.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple script to test mountGpoint for read-write

Guys, need your help urgently. ServerA ServerB ServerA has an email facility and can connect remotely via root using key to ServerB What I am trying to achieve here is ServerA would be able to remotely: 1. Do command 'touch /mnt/testfile.date' on ServerB 2. If touch failed with... (4 Replies)
Discussion started by: jaapar
4 Replies

2. Linux

How to execute a simple select script using a shell script?

Hi team, I have two select statements and need to run them using SYSDBA user select * from temp_temp_seg_usage; select segment_name, tablespace_name, bytes/ (1024*1024) UsedMb from dba_segments where segment_name='TEMP_TEMP_SEG_USAGE'; Need to run this using a shell script say named... (1 Reply)
Discussion started by: pamsy78
1 Replies

3. Homework & Coursework Questions

Shell Script to read a tab delimited file and perform simple tasks

1. The problem statement, all variables and given/known data: Hello! I need help with this problem bash shell scripting that basically just reads the data in a tab delimited file and does the following below 1. Read in the data file Survey.txt and assign the column values to variables of... (6 Replies)
Discussion started by: jsmith6932
6 Replies

4. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

5. Shell Programming and Scripting

Simple while read line loop question

#!/bin/bash count=1 while read line do if (($count > 4)); then awk -v var1="$count" '{printf "%3s%8s%11s%11s%11s\n",var1,$2,$3,$4,$5}' else echo $line fi count=$((count+1)) done < posre_sub.itp > test cat test INPUT: ; position restraints for... (3 Replies)
Discussion started by: origamisven
3 Replies

6. Shell Programming and Scripting

Simple While read causing issues

Hi, I have a simple while loop (ksh scripting). while read ln1 do echo $ln1 done < $LogDir/$LogFile the echo statement is displaying log file contents + also the files in $LogDir. I am not sure how it is displaying the files under $LogDir. There is no ls command either in... (3 Replies)
Discussion started by: tostay2003
3 Replies

7. UNIX for Dummies Questions & Answers

simple way to read an array in ksh

hi, I'm a newbie to shell scripting. I wanted to initialise an array using basic for loop and read it. Then i want to print it as a .CSV file.. Any help would me much appreciated.. (1 Reply)
Discussion started by: pravsripad
1 Replies

8. UNIX for Dummies Questions & Answers

Please help me with this simple script

Hello, I'm new to unix but i would like to learn it step by step. Looks more complicated than php but i still want to give it a try. I want to write a script to print the number and the value of the variables that match the string written from the keyboard. I know how to do it in PHP and... (6 Replies)
Discussion started by: Blue
6 Replies

9. Shell Programming and Scripting

simple script

i have a script that check for the last date entry made in a series of files -------------------------------------------------------------------- a=`date +"%Y-%m-%d"` for i in *.log* do cat $i | grep $a echo $i >> file1.txt echo $a >> file1.txt done... (1 Reply)
Discussion started by: ali560045
1 Replies

10. Shell Programming and Scripting

Simple Bash Read File question

Hello all, I am trying to write a simple script that will parse through a text/properties file and check a couple of if statements. Here is what I have so far: FILENAME=$1 while read line do echo $line done < $FILENAME When I call ./simple.sh testfile.txt I recieve a file or... (7 Replies)
Discussion started by: lamagra
7 Replies
Login or Register to Ask a Question