LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-09-2010, 11:37 PM   #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-09-2010, 11:47 PM   #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, 12: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, 12:26 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 12:27 AM.
 
Old 11-10-2010, 12: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, 01: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 01:10 AM.
 
  


Reply



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 11:56 AM
Finding a grave character (~) atari05 Linux - Newbie 3 01-09-2008 01:54 AM
Grave hardware problems Gins Linux - General 13 01-06-2008 08:29 AM
cat in asm/ cat --show-all option Tux Linux - Software 1 09-02-2006 09:31 PM
accent grave ague in kde suse 10!! how??? Randall Slack SUSE / openSUSE 6 01-19-2006 12:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 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
Open Source Consulting | Domain Registration