Unable to echo the content


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unable to echo the content
# 8  
Old 02-21-2013
I'm sorry the below line is there on my script.

#! /usr/bin/kshWondering why it cant execute, on all the servers?

I know the syntax is correct, but how to make it work on all the servers?
# 9  
Old 02-21-2013
Is ksh the same place on all servers, or can be made to seem so with a symlink? (The #! thing and similar concerns like execute permissions are detailed in the execvp() man page Man Page for execvp (opensolaris Section 0) - The UNIX and Linux Forums )

If the permissions or ksh location cannot be fixed, call it with "ksh script-name script-args".
# 10  
Old 02-21-2013
/usr/bin/ksh (Korn shell) is typically not available on BSD Unix and Linux, unless it is installed as an extra package.
Even hostname might not exist an some SysV Unix.
But all Unix have /bin/sh and should have uname -n
Code:
#!/bin/sh
echo "XYZ\\`uname -n`-volume" >> 123

If your script has got ksh extensions so does not run with /bin/sh, try the following shebang:
Code:
#!/bin/ksh

or
Code:
#!/usr/bin/env ksh


Last edited by MadeInGermany; 02-21-2013 at 04:15 PM.. Reason: code tags
# 11  
Old 02-21-2013
Yes, I really liked the idea of
Code:
'uname -n'

But #! /usr/bin/ksh or other shebang is not the issue in here, because all the remaining 200 lines script works fine except below.

Code:
'echo "XYZ\\`uname -n`-volume" >> 123'

Which clearly says that it is not an issue concerned with shebang.

Please suggest me further. I believe is concerned with shell. If may be, how to fix this bug with respect any server?
# 12  
Old 02-21-2013
What does it do wrong? Maybe s/b:
Code:
echo 'XYZ\'`uname -n`'-volume' >> 123

# 13  
Old 02-21-2013
There is no problem with the syntax, as per I understand.

Because i used it over 100 servers and it worked perfectly alright.

Code:
echo "XYZ\\`uname -n`-volume" >> 123
cat 123
XYZ\hostname-login

But on some servers even thought they are same OS it is not working as desired.

Code:
echo "XYZ\\`uname -n`-volume" >> 123
cat 123
XYZ


Is there any command on shell scripting which can fix the SHELL issue?

Like set -o?? just wondering.
# 14  
Old 02-22-2013
Call it with "sh scriptname'" so the actual location of 'sh' is determined by local $PATH environment.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to print "|" in echo

I have a small script that works well but when I am putting pipes at the end of the echo command, output is getting weird. My script it below: sed '1d' CONTROL_TOTALS_*.txt | while read eachline do tblnm=`echo $eachline | cut -d'_' -f3` if then stg_tblnm='PROVIDER_CONTRACT' elif then... (6 Replies)
Discussion started by: svks1985
6 Replies

2. Shell Programming and Scripting

Facing issues with Content-Type:application/x-download Content-Disposition:attachment

I am in the process of developing a perl cgi page. I had succeeded in developing the page but there are few errors/issues with the page. description about cgi page: My CGI page retrieves all the file names from an directory and displays the files in drop down menu for downloading the... (5 Replies)
Discussion started by: scriptscript
5 Replies

3. Shell Programming and Scripting

Unable to echo single quotes inside awk

# echo 'export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk '{print \$1}')' >> new_file # # cat new_file export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk {print $1}) # Now how to echo the quotes around the... (2 Replies)
Discussion started by: proactiveaditya
2 Replies

4. Shell Programming and Scripting

Help with remove duplicate content and only keep the first content detail

Input data_10 SSA data_2 TYUE data_3 PEOCV data_6 SSAT data_21 SSA data_19 TYUEC data_14 TYUE data_15 SSA data_32 PEOCV . . Desired Output data_10 SSA data_2 TYUE data_3 PEOCV data_6 SSAT data_19 TYUEC (9 Replies)
Discussion started by: patrick87
9 Replies

5. Shell Programming and Scripting

With that logic this echoes "echo". Question about echo!

echo `echo ` doesn't echoes anything. And it's logic. But echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo" (too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies

6. AIX

Unable to get the full content into a file when I redirect installp command output..

When i use the command to check the preview of the filesets to be installed using CLI # When using this commad 'm able to see all Preview view of the filesets to be installed installp -apgX -d "." all # When I redirected the same output to a file 'm able to see only half the details... (1 Reply)
Discussion started by: Sounddappan
1 Replies

7. Shell Programming and Scripting

sed, awk [TAG]$content[/TAG] How to get var in $content in textfile?

Hello, I got a Qstion. Im posting to a phpbb forum with bash and curl.. i have a text file with the following tags that i post to the forum: $var1 $var2 $var3 How can i with sed or awk put var content from shell script between the ... in the... (7 Replies)
Discussion started by: atmosroll
7 Replies

8. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

9. Shell Programming and Scripting

Difference between using "echo" builtin and /bin/echo

So in my shell i execute: { while true; do echo string; sleep 1; done } | read line This waits one second and returns. But { while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly. I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies
Login or Register to Ask a Question