I considered non-printing characters, but when I put vi into hex mode to investigate I found nothing amiss. Just EOL (x'0A') where they should be.
With the suggested hyphen, no joy:
Out of desperation, I tried re-typing the entire script from scratch - no copy and paste. This time it worked.
---------- Post updated 06-29-18 at 08:25 AM ---------- Previous update was 06-28-18 at 02:41 PM ----------
Quote:
Originally Posted by RudiC
There you are - EOF with three trailing spaces! Try without.
Well, I learned something today. I knew that the EOF had to be at the beginning of the line (immediately following x'0a', but never knew that it was also sensitive to trailing spaces. Thanks for catching that.
PS: /bin/sh is the bourne shell for oracle linux. I think it is supposed to be POSIX-compliant, Don Cragun might know.
The Bourne shell is not a POSIX-compliant shell. The shell specified by the POSIX standard was based on the Bourne shell with some Korn shell changes and extensions.
/bin/sh on most Linux systems is a bash or dash shell with options set so that it is intended to act like a POSIX-compliant shell, but is not tested to conform to POSIX requirements by any POSIX or UNIX conformance test suite.
A here-document has two things that control how it works. In the form:
where no part of word is quoted, the input fed into command is the result of performing parameter expansions, command substitutions, and arithmetic expansions on contents. If any part of word is quoted, the input fed into command is contents. The end of contents is identified by a line containing exactly the contents of delimiter immediately followed by a <newline> character where delimiter is word after quote removal has been applied.
In the form:
all leading <tab> characters in each line of contents and in the terminating line containing delimiter are discarded before the actions mentioned above are applied. (Note that it is just leading <tab>s; not leading <tab>s and/or <space>s.)
There is a text file in my project named as "mom.txt" in which i want to have contents like..................
LSCRM(Application Name):
1: This is my first application.
2: Today we did shell scripting automation for this app.
3: It was really a good fun in doing so.
4: Really good.| (Here i... (7 Replies)
Hi,
Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV
I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters.
Any help would... (2 Replies)
Hi,
I have a No Delimiter variable length text file with following schema -
Column Name Data length
Firstname 5
Lastname 5
age 3
phoneno1 10
phoneno2 10
phoneno3 10
sample data - ... (16 Replies)
I try to ssh uses bash script in here-document like this.
ssh root@$SERVER <<EOF
if ; then
service httpd start
fi
exit
EOF
But got an error below.
maybe the if command causes the problem. Thanks for help. (2 Replies)
Can we use a here document inside a here document?
Something like this
ssh user@remotehost << REMOTE
sudo vserver vsernamename enter << VSERVER
perform actions on vserver.
VSERVER
REMOTE (6 Replies)
Have a sudo statement inside of a here document. It prompts me for a password, but doesnt wait for me to enter my password. Is there a way I can use the command without sudo or anyway that I can enter the password correctly?
Eg :
while read remotehost
do
ssh -t $2@$remotehost ... (0 Replies)
Hello,
i encountered this in perl but it might be command line related as well:
i am sending text as an argument to echo command on remote computer.
if the text has alphanumeric characters only, say 'hello world' all is well. if however text has metacharachters, e.g. 'hello | world' or even... (2 Replies)
I have more than 1000 files to parse. Each file contains few lines (number of lines varies) followed by a header line having all column's name (SPOT, NAME etc) and then values for those columns.
**Example File:
sdgafh
dfhaadfha
sfgaf dhah jkthdj
SPOT NAME GENE_NAME CH_MEAN CHDN_MED ... (11 Replies)
Hi,
I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
I am trying to extract 'postmaster' from the following string:
PenaltyError:=554 5.7.1 Error, send your mail to postmaster@LOCALDOMAIN
using the following command:
cat /usr/share/assp/assp.cfg | grep ^PenaltyError:= | cut -d '@' -f1 | cut -f8
but it returns:
PenaltyError:=554 5.7.1 Error,... (10 Replies)