![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To call/execute a shell script from a shell script | konark | UNIX for Dummies Questions & Answers | 1 | 10-26-2007 02:16 PM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 02:19 AM |
| How to Run a shell script from Perl script in Parent shell? | hifake | Shell Programming and Scripting | 16 | 08-28-2007 05:42 PM |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 1 | 04-30-2007 05:43 AM |
| Have a shell script call another shell script and exit | heprox | Shell Programming and Scripting | 2 | 11-20-2006 05:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need a help in the Shell script which is erroring out
Hi all
I want to add this line after a line This is the line which needs to be add after the word permission echo 'profile: /export/home/unix1/auto.pr' >> $xxyy if [ "$value" = "add" ];then cd $unixserv/unix sed ' /permission/ a\ echo 'profile: /export/home/unix1/auto.pr' >> $xxyy generate_autosys_job.ksh > man5.txt Can you please let me know what is the error Its not adding the line as it is :echo 'profile: /export/home/unix1/auto.pr' >> $xxyy Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
try the following:
Code:
echo "\047profile: /export/home/unix1/auto.pr\047 >> $xxyy" |
|
#3
|
|||
|
|||
|
the following is not working ..
is there any other way to fix this Thanks |
|
#4
|
|||
|
|||
|
To output text within single quotes you can place the text within: single quote, double quote, single quote:
Code:
echo '"'profile: /export/home/unix1/auto.pr'"' >> $xxyy |
|
#5
|
|||
|
|||
|
Thanks Guys , But its not working , can you please help m once again ??
This is the code, not able to add the line echo 'profile: /export/home/'$value'/auto.profile-45' >> $job_name_main' sed' /permission/ a\ echo '"'profile: /export/home/'$value'/auto.profile-45'"' >> $job_name_main' Thanks |
|
#6
|
|||
|
|||
|
any help ?? in this one
Thanks |
|
#7
|
||||
|
||||
|
Hi.
One method is to use double quotes to allow the single quotes to be treated as normal characters. However, because shell variables are expanded within double quotes, the "$" needs to be escaped: Code:
#!/usr/bin/env sh
# @(#) s1 Demonstrate insert of line with single quotes and variable.
set -o nounset
echo
debug=":"
debug="echo"
## Use local command version for the commands in this demonstration.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version bash sed
echo
FILE=${1-data1}
echo " Input file $FILE:"
cat $FILE
echo
echo " Results from sed:"
sed "
/permission/ a\
echo 'profile: /export/home/unix1/auto.pr' >> \$xxyy
" $FILE
exit 0
Code:
% ./s1 (Versions displayed with local utility "version") GNU bash 2.05b.0 GNU sed version 4.1.2 Input file data1: This is a line Another line This line contains permission. This is the line that should appear after the inserted line. Last line. Results from sed: This is a line Another line This line contains permission. echo 'profile: /export/home/unix1/auto.pr' >> $xxyy This is the line that should appear after the inserted line. Last line. |
||||
| Google The UNIX and Linux Forums |