10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am using simple for loop, but getting syntax error when I run the code
code
#!/bin/ksh
pls enter number
read n
for(i=1; i<=n; i++)
do
echo $i
done
syntax error
+ pls enter number
+ read n (5 Replies)
Discussion started by: stew
5 Replies
2. Shell Programming and Scripting
Hi gurus,
I hit a block when write the script.
I need do while loop, in the loop I have code below.
sqlplus -s abc/abc@abc <<EOF
spool testwhile
select *
from dual;
spool off
exit;
EOF
when I run script with only this code, it works fine.
if I add code as below:
#!/bin/ksh
... (5 Replies)
Discussion started by: ken6503
5 Replies
3. Shell Programming and Scripting
The code at the bottom is a simplified example of what we have.
If I use the following:
&& echo "echo failed"
$? returns 1
When I use
if ; then echo "echo failed" ; fi
$? returns 0
Does anyone know what's wrong with this?
Using AIX 6.1 and KSH
for NUM in 1 2 3
do
... (5 Replies)
Discussion started by: jfxdavies
5 Replies
4. Shell Programming and Scripting
I am getting the following error when I am running a script in ksh when trying to execute an if statement comparing two numerical values
tstmb.sh: 1.5321e+08: 0403-057 Syntax error
Below is my code snippet.
#!/bin/ksh
set -x
TODAY=$(date +%y%m%d)
for file in $(ls -rt *.log | tail... (11 Replies)
Discussion started by: kiran1112
11 Replies
5. Shell Programming and Scripting
curr_time=`date +%Y%m%d%H%M`
curr_date=`date +%Y%m%d`
zero=0
script_path="/home/wccuser1/wcc/Scripts/bulk_file_ftp"
file_dir="/home/wccuser1/wcc/Bulk_Files"
todays_file_count=`ls -ltr | grep $curr_date | awk '{print $9}' | wc -l`
todays_file=`ls -ltr | grep $curr_date | awk '{print $9}'`
if... (5 Replies)
Discussion started by: gagandeep
5 Replies
6. Shell Programming and Scripting
I am trying to run a menu option though IF loops. I keep getting errors not allowed the menu to be processed correctly. Currently it will accept the first 2 statements but then crash on the 3rd. The 2nd and 3rd have the same syntax, so I do not understand why it breaks.
#!/bin/bash
while... (4 Replies)
Discussion started by: Ironguru
4 Replies
7. Shell Programming and Scripting
I'm getting an error while running this script. Need help.
set -x verbose #echo on
clear #clear the screen
USERNAME="bbb"
PASSWORD="password"
SERVER="192.168.1.100"
WAIT_TIME=300
FILE_PATH="/home/users/xxx/MMM" # local directory to pickup *.dat file
REMOTE_PATH="/Drop_off/xxx/yyy" #... (17 Replies)
Discussion started by: clgz2002
17 Replies
8. Shell Programming and Scripting
Hi
Can any one help, I'm trying to run a script that beeps out the ip address from the PC internal speaker with the following script. It keeps throwing the error "Syntax error: Bad for loop variable" on line 16. I know its picking up the IP ADDRESS correctly. Any ideas on whats wrong. I'm... (3 Replies)
Discussion started by: dman
3 Replies
9. Shell Programming and Scripting
Hi guys,
I'm trying to loop through a number of files that is set by whatever is in a field.
eg.
The idea is to split FILELIST down into fields, it could contain 1 - 999 fields and it's bar delimited.
I thought simple, count the number of fields in the field and then loop... (1 Reply)
Discussion started by: Peejay
1 Replies
10. Shell Programming and Scripting
Hi,
I have the following script (compile_mercury) and I get this error: I have no idea why...and I have written this script completely in linux (bash) and not in windows.
****************
./compile_mercury: line 136: syntax error near unexpected token `done'
./compile_mercury: line 136:... (1 Reply)
Discussion started by: habzone2007
1 Replies