Multiple if statements in script and unexpected end of file
Two things...
1) If I have an if statement that is true I want it to exit without running the rest of the file, but if it is false I want it to continue.. I just did
Can that work? I want it to exit if $1 is 0, and if not to continue running the rest of the script. Is it ok to have an exit command conditionally earlier on in the script?
2) If i want to have multiple if then fi statements in a shell script, can I just have several in the same script or is there something else that needs to be done? I have a few like the one above in the same script and seem to get unexpected end of file when I do that, why is this?
what do u mean by " 'end of file' unexpected "?
i am running a script called "s1" which internally calls "s2"
now s1 starts running & at a point (where it is suppose to call "s2")
i get a message
'end of file' unexpected....
& my script(s) are not working..
any ideas on this?
regards... (4 Replies)
This is the script
path=/oracle/ora10gdb/sample
archive=/oracle/ora10gdb/archive
cd $path
for i in `ls`;do
mv $i $archive
Done
Please tell me why it is givind this error (2 Replies)
HELP PLEASE!!
I am running this script, and i keep getting the error 'end of file' unexpected. I know that usually means parenthesis or whatever is out of place but i cant find anything!! I am new to scripting and i put some "print" staements in and it is not getting past the first IF statment... (7 Replies)
Hi All,
I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected".
I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
I am getting a "line 47: syntax error: unexpected end of file", why? According to my estimate, line 47 is 2 lines after the last line of code here. Also, the $1 variable represents the current user logging in, and the script runs with root privileges (This is a Mac OS login hook script using... (5 Replies)
Hi,
On adding below code to my script shows the error on executing else script works fine.
sqlplus $user_name/$password <<EOL
truncate table order;
commit;
truncate table order_hist;
commit;
insert into order(ID,TRAN,CUST_NAME,OPT_VAL) select * from order_bkp;
insert into... (5 Replies)
first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good.
I appreciate... (3 Replies)
Well, this is a very crazy issue, and I'm scratching my head to find a solution.
This is a simple code to tranfer a file, in my main script I need to add a conditional statement (IF/THEN) like the below example:
#!/bin/bash
if ; then
ftp -inv "192.168.1.10" << EOFTP
user... (8 Replies)
I dont know where I missed the double quotes .:wall:pls review this code and help me out .
m1: line 26: unexpected EOF while looking for matching `"'
m1: line 34: syntax error: unexpected end of file
echo "script is created by prabhu Kumar ";
echo "changing the directory to wes... (2 Replies)
Discussion started by: ptappeta
2 Replies
LEARN ABOUT OPENDARWIN
script
SCRIPT(1) BSD General Commands Manual SCRIPT(1)NAME
script -- make typescript of terminal session
SYNOPSIS
script [-a] [-k] [-q] [-t time] [file [command ...]]
DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an
interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript.
If the argument command ... is given, script will run the specified command with an optional argument vector instead of an interactive shell.
Options:
-a Append the output to file or typescript, retaining the prior contents.
-k Log keys sent to program as well as output.
-q Run in quiet mode, omit the start and stop status messages.
-t time Specify time interval between flushing script output file. A value of 0 causes script to flush for every character I/O event. The
default interval is 30 seconds.
The script ends when the forked shell (or command) exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if
ignoreeof is not set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not
manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one.
ENVIRONMENT
The following environment variable is utilized by script:
SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most
shells set this variable automatically).
SEE ALSO csh(1) (for the history mechanism).
HISTORY
The script command appeared in 3.0BSD.
BUGS
The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
It is not possible to specify a command without also naming the script file because of argument parsing compatibility issues.
When running in -k mode, echo cancelling is far from ideal. The slave terminal mode is checked for ECHO mode to check when to avoid manual
echo logging. This does not work when in a raw mode where the program being run is doing manual echo.
BSD June 6, 1993 BSD