Author Topic: {/usr/bin/Solved} Quick question: How do I escape the backtick character?  (Read 1699 times)

Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Having trouble with a spec where I need a way to escape the backtick character `

I've tried \` but that does not work (and I get the result from the actual command in the way wrong place...doh...)

any help appreciated!

cheers,
MBantz
« Last Edit: June 22, 2010, 02:49:14 PM by MBantz »

Offline wyohman

  • Hero Member
  • *****
  • Posts: 1346
  • Texas, USA
    • Shelby Registry
Re: Quick question: How do I escape the backtick character?
« Reply #1 on: June 22, 2010, 12:48:20 PM »
Having trouble with a spec where I need a way to escape the backtick character `

I've tried \` but that does not work (and I get the result from the actual command in the way wrong place...doh...)

How about:

'`Text`'

Using single quotes should have the same effect as the escape character with the possibility of less overhead.

Cheers.
SZ77R5 | I7 3770 | 16GB | Samsung 840Pro | HD6670 | PCLOS 2012
Linux user since kernel 0.93

Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Re: Quick question: How do I escape the backtick character?
« Reply #2 on: June 22, 2010, 02:23:03 PM »
Thanks wyohman, I now just get the first '

The line in the specfile is currently this:


xml ed ...
...
-s "/actions/action[last()]" -t elem -n command -v "xterm %{xtermopt} +hold -e bunzip2 '%f' && xz - -9 %d/'`basename '%f' .bz2'`" \
...
..


and it's the `basename '%f' .bz2'` that evaluates too early (the trick is to insert the command as a menu option for Thunar fm to be able to repackage a bz2 archive to xz format), ie.

bunzip2 '%f' && xz - -9 `basename '%f' .bz2'` (bunzip to the tar file and compress tarfile to xz)
« Last Edit: June 22, 2010, 02:50:13 PM by MBantz »

Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Re: Quick question: How do I escape the backtick character?
« Reply #3 on: June 22, 2010, 02:48:11 PM »
Solved!

the first idea was the right one - \`

but it is necessary to escape the escape character  ::)

This works: \\\`

Now recompressing archives is a breeze! (this is pkgutil-thunar I'm working on) - xz compression is -very- efficient!!

Offline Padma

  • Hero Member
  • *****
  • Posts: 1099
  • The Outbond
    • Civilization Fanatics Center
Ah, you figured it out while I was typing my reply. ;)
1st Lieutenant, USAFR (Retired)
Co-Administrator: Civilization Fanatics Center

Ramblings of a Professional Computer Geek


Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Sorry Padma :-) but a big thank you anyways :-)

EDIT: xz compresses impressively - a 100MB tgz archive compresses to a 65MB xz archive.. just a right-click away :-)
« Last Edit: June 22, 2010, 03:16:26 PM by MBantz »