03-24-2009
double backslash in ksh
Hi
I need the "\\hello" (without double quotes) to be written to a file.
echo "\\\\hello" >file is working under bash shell but not working under ksh shell (gives only one / in the output)
Please advise.
TIA
Prvn
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have a variable whose value is like this
i=/test/test1/test2/myfile.cd.070505123457
i would like to have the value of myfile.cd stored into another variable
my attempt is
test=${i##*/} ;echo $test ##and i get
myfile.cd.070505123457
since what i wnat is myfile.cd i try this... (19 Replies)
Discussion started by: xiamin
19 Replies
2. Shell Programming and Scripting
How do I execute a command containing a double quote ?
I pass a variable to grep that contains spaces, so I need to quote it,
but it does not work.
#!/usr/bin/ksh
set -x
txt='"next to"'
cmd="grep $txt ~dpearso5/file2"
echo $cmd
$cmd
This is the error I get:
+ grep "next to"... (1 Reply)
Discussion started by: pearson05
1 Replies
3. UNIX for Dummies Questions & Answers
I have a variable containt something like this, c:\mask\mask. How can I escape "\" in the values? I want the value as it it. (9 Replies)
Discussion started by: swmk
9 Replies
4. Shell Programming and Scripting
Hi
First apologies if this has been raised before.
I've got the following in a ksh script:
if ]
For some reason this does not work. But if I remove the double square brackets to:
if
This works.
I thought ksh supported the ]. Or is there more to it?
Thanks in advance. (3 Replies)
Discussion started by: tsu3000
3 Replies
5. Shell Programming and Scripting
Hi All,
I have a requirement to read a line from a file with some search string, replace any backslash characters in that line and store in a variable.
Shell script: replace.ksh
#!/bin/bash
file2=input.rtf
line=`grep "Invoice Number" ${file2} | head -1 | sed 's/\\//g'`
echo "start... (6 Replies)
Discussion started by: prashas_d
6 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to add a tag in the *.imp file.
This is a piece of code which I am giving in my template file and my script reads this template file attachment and passes to windows server(as they have provided the below file path).
... (3 Replies)
Discussion started by: defendersubbu
3 Replies
7. Shell Programming and Scripting
If I echo "\\" I get a backslash returned
~$ echo "\\"
\
Why doesn't this work:
string=`echo "\\"`
echo $string
I get the error message:
bash: command substitution: line 1: unexpected EOF while looking for matching `"'
bash: command substitution: line 2: syntax error: unexpected end... (2 Replies)
Discussion started by: locoroco
2 Replies
8. Shell Programming and Scripting
Can somebody tell me the difference between double brackets and single
brackets, when doing a test.
I have always been acustomed to using single brackets and have not
encountered any issues to date. Why would somebody use double brackets.
Ie
if ]
vs
if
Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies
9. Shell Programming and Scripting
In bash or perl, I would like to know how to substitute a null character (0x00) for every white space without changing the white spaces inside the block of double quotes and the white space immediately following a backslash.
Suppose that sample.txt consists of the following line.
"b 1" c\ 2
... (2 Replies)
Discussion started by: LessNux
2 Replies
10. Shell Programming and Scripting
I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them.
Example:
"015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command:
... (4 Replies)
Discussion started by: Shimmey
4 Replies