Sponsored Content
Top Forums Shell Programming and Scripting [Solved] <<EOF error checking Post 302469874 by BeefStu on Monday 8th of November 2010 12:52:49 PM
Old 11-08-2010
[Solved] <<EOF error checking

I am trying to check the return status of a command thats encapsulated
in an <<EOF

Code:
#!/bin/ksh
set -x
xxx()
{
set -x
ls -lt /tmp/jdlkewjdlkewjdlkewjdlewjdlew<<EOT
ret=$?
EOT
echo "ret=$ret"
} >>$LOG 2>&1

LOG=/tmp/t2.out
rm -rf $LOG
echo "Starting process `date +"%Y-%m-%d-%H:%M:%S"`" >> $LOG
xxx
echo "Ending process `date +"%Y-%m-%d-%H:%M:%S"`" >> $LOG

As you can see from the set -x output (below) this file does not
exist and when I execute $? from the commnad line I get back a non zero.

Can somebody show me how to get back the return status when something is encapulated in <<EOF


Code:
Starting process 2010-11-08-12:39:53
+ ls -lt /tmp/jdlkewjdlkewjdlkewjdlewjdlew
+ 0<<
ret=0
/tmp/jdlkewjdlkewjdlkewjdlewjdlew: No such file or directory
+ echo ret=
ret=
Ending process 2010-11-08-12:39:53

---------- Post updated at 12:52 PM ---------- Previous update was at 12:44 PM ----------

Please ignore I figured it out, placed $? out of EOF
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar: write error: unexpected EOF

I am taring to disk and get this message: tar: write error: unexpected EOF This message is normally associated with tape devices, not disk. Here is the syntax: tar -cf <tarfilename> /dir Have you seen this message on disk tars? (4 Replies)
Discussion started by: jabe
4 Replies

2. Shell Programming and Scripting

Unexpected eof error

Hi, I am newbie and am just trying to connect to oracle from shell script ,,,but I am getting the following error ./prog.sh: line 20: syntax error: unexpected end of file The scripts is : #!/bin/bash O=$IFS; IFS=","; while read a b c d do echo $c ... (6 Replies)
Discussion started by: thana
6 Replies

3. UNIX for Advanced & Expert Users

tar:read error: unexpected EOF

I need archive data from some tar files. I use the command "tar xvf filename". For about half of the files I get the error message "tar:read error: unexpected EOF". The number of bytes extracted comes very close to the size of the tar file. An example: 972434779 Jan 10 01:01... (4 Replies)
Discussion started by: mikeruth
4 Replies

4. Programming

EOF checking the below

Hi, I am practicing exercise programs with System calls. Exercise Question: write a pogram to accept a filename from the user. The program should write ecery fifth byte of the file to the standard output. My Program : # include <stdio.h> # include <fcntl.h> # include <error.h> ... (10 Replies)
Discussion started by: ramkrix
10 Replies

5. UNIX for Dummies Questions & Answers

Unclosed EOF (error)

I have a script which throws an error: "here document `EOF' unclosed" The script is: ... main() { RETVAL=`sqlplus -s $ConnectDetails << EOF SET SERVEROUTPUT ON DECLARE errnum NUMBER; errmsg VARCHAR2(1000); BEGIN My_Procedure( errbuf => errmsg, errcode... (2 Replies)
Discussion started by: laiko
2 Replies

6. Shell Programming and Scripting

bash: checking file size -solved

Hello I have srv RHEL5, file system UTDM (EMC DiskXtender Unix/Linux File System Manager 3.5 & EMC Centera). it all works under the scheme: have disk is formatted with a file system UTDM, drive open network - NFS, it write data, then migrate the data in the repository - EMC Centera. There are... (0 Replies)
Discussion started by: moskovets
0 Replies

7. Shell Programming and Scripting

help pls getting EOF error

#!/bin/bash while : do clear echo ""***************************************" echo "* - MAIN - MENU - *" echo "***************************************" echo "* 1. Directory Listing *" echo "* 2. Users Currently Logged In *" echo "* 3. Create a... (2 Replies)
Discussion started by: celtic123
2 Replies

8. UNIX for Advanced & Expert Users

tar: write error: unexpected EOF

tar: write error: unexpected EOF I usually encounter this when I'm doing backup to Dat72 tape. Here's the command gzip all files in a directory then tar cvfp /dev/rmt/0n files. Not all files are copied. Any things I should look at? Directory size? ---------- Post updated at 05:20 PM... (1 Reply)
Discussion started by: lhareigh890
1 Replies

9. Shell Programming and Scripting

Error with EOF when used in function

Hi all I am inserting record in oracle database using shell script. When the sql part is directly written in the shell script the record is getting inserted. But when the same piece of code is added into a function, I am getting an error while execution "line 45: syntax error: unexpected end of... (6 Replies)
Discussion started by: sudeep.id
6 Replies

10. 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
XINETD.LOG(5)							File Formats Manual						     XINETD.LOG(5)

NAME
xinetd.log - xinetd service log format DESCRIPTION
A service configuration may specify various degrees of logging when attempts are made to access the service. When logging for a service is enabled, xinetd will generate one-line log entries which have the following format (all entries have a timestamp as a prefix): entry: service-id data The data depends on the entry. Possible entry types include: START generated when a server is started EXIT generated when a server exits FAIL generated when it is not possible to start a server USERID generated if the USERID log option is used. NOID generated if the USERID log option is used, and the IDONLY service flag is used, and the remote end does not identify who is trying to access the service. In the following, the information enclosed in brackets appears if the appropriate log option is used. A START entry has the format: START: service-id [pid=%d] [from=%d.%d.%d.%d] An EXIT entry has the format: EXIT: service-id [type=%d] [pid=%d] [duration=%d(sec)] type can be either status or signal. The number is either the exit status or the signal that caused process termination. A FAIL entry has the format: FAIL: service-id reason [from=%d.%d.%d.%d] Possible reasons are: fork a certain number of consecutive fork attempts failed (this number is a configurable parameter) time the time check failed address the address check failed service_limit the allowed number of server instances for this service would be exceeded process_limit a limit on the number of forked processes was specified and it would be exceeded A DATA entry has the format: DATA: service-id data The data logged depends on the service. login remote_user=%s local_user=%s tty=%s exec remote_user=%s verify=status command=%s Possible status values: ok the password was correct failed the password was incorrect baduser no such user shell remote_user=%s local_user=%s command=%s finger received string or EMPTY-LINE A USERID entry has the format: USERID: service-id text The text is the response of the identification daemon at the remote end excluding the port numbers (which are included in the response). A NOID entry has the format: NOID: service-id IP-address reason SEE ALSO
xinetd(1L), xinetd.conf(5) 28 April 1993 XINETD.LOG(5)
All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy