LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2010, 12:37 AM   #1
sjo
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
doing a cat on grave accent


Dear experts,
I am in a situation where I need to generate as script for a graphical package on fly from with in a shell script. I would like to do the below which create a file in which grave accent has to be there
However below script do not work I tried different things like
'''`nc_v[i=2]`''' etc but none appears to work any help on this is greatly appreciated

cat > ./comp_cur.jnl << DLIM
go set_view
let nc_v=..varnames
def sym u="`nc_v[i=2]`"
def sym v="`nc_v[i=3]`"
set vie v11
ppl txlabp 0
plot/nolab/set '($u)',hyc_u[d=1]*100
DLIM

with best regards,
Sudheer
 
Old 11-10-2010, 12:47 AM   #2
Jerre Cope
Member
 
Registered: Oct 2003
Location: Texas (central)
Distribution: ubuntu,Slackware,knoppix
Posts: 323

Rep: Reputation: 37
Use the \ character to escape the back tick (grave)

ie:

\'

You can even use the \ to escape itself \\
 
Old 11-10-2010, 01:18 AM   #3
sjo
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you Cope,
Did you mean as below then it did not work for me. I am using Ubuntu 10.04 with bash shell

$ cat ts
cat > ./comp_cur.jnl << DLIM
go set_view
let nc_v=..varnames
def sym u=\`nc_v[i=2]`\
def sym v=\`nc_v[i=3]`\
set vie v11
ppl txlabp 0
plot/nolab/set \'($u)'\,hyc_u[d=1]*100
DLIM
sjo@sjo-laptop:/media/SJO250/Rama_moor/RAMA_9-NOV-2010/CUR$ sh ts
ts: 2: Syntax error: EOF in backquote substitution
 
Old 11-10-2010, 01:26 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You seem to be mixing backquote (`) and single quote ('). These are NOT the same.
Normally, `$nnn` is used to run a var as a cmd (old school style). The modern idiom in bash is

$($nnn)

instead.
Note tha tin both cases, it runs in a sub-shell; see links below.

Single quotes are used to stop bash interpolating values that look like vars eg

'$fred'

is seen as just fred, whereas double quotes "$fred" would allow bash to interpret the $ sigil as the beginning of a var named fred.
See http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/

Incidentally, escaping means putting the \ just before the char in qn. Eg \` means a literal backquote.
Adding one after the backquote has zero effect on the backquote.

HTH

Last edited by chrism01; 11-10-2010 at 01:27 AM.
 
Old 11-10-2010, 01:44 AM   #5
sjo
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you Guru
using \`ss\` solved my problem with grave accent and this '(\$u)' with $u in bracket
 
Old 11-10-2010, 02:09 AM   #6
dharanivasan
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Rep: Reputation: 1
Let you try this way:

cat > ./comp_cur.jnl << 'DLIM'
go set_view
let nc_v=..varnames
def sym u=\`nc_v[i=2]`\
def sym v=\`nc_v[i=3]`\
set vie v11
ppl txlabp 0
plot/nolab/set \'($u)'\,hyc_u[d=1]*100
DLIM

It is the example of here-document, but with parameter substitution disabled.

Last edited by dharanivasan; 11-10-2010 at 02:10 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Accent grave in ubuntu 8.04 tsp907 Linux - Newbie 1 10-26-2008 12:56 PM
Finding a grave character (~) atari05 Linux - Newbie 3 01-09-2008 02:54 AM
Grave hardware problems Gins Linux - General 13 01-06-2008 09:29 AM
cat in asm/ cat --show-all option Tux Linux - Software 1 09-02-2006 10:31 PM
accent grave ague in kde suse 10!! how??? Randall Slack SUSE / openSUSE 6 01-19-2006 01:47 PM


All times are GMT -5. The time now is 01:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration