6

I'm trying to use rc shell (Linux port from Plan9 OS) and get 'syntax error' messages when using programs with arguments like arg=val.

; dd if=/dev/zero of=/dev/null
syntax error
; ls --color=auto
syntax error

My guess is that rc shell sees = sign and treats the statement as variable assignment, not a program run. May be there's no dd program or other programs using this type of arguments in Plan9. But how can I use it in Linux where they are widely used?

I tried escaping = like dd if\=... of\=, it didn't help.

I tried quoting arguments like dd 'if=/dev/zero' 'of=/dev/null' 'bs=1M' 'count=1' and it worked. But it's not very comfortable. Is there any other more handy way?

I'm using rc shell from Ubuntu 11.10 repository: package version 1.7.1-3ubuntu1.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
wobmene
  • 963
  • 1
  • 7
  • 9

1 Answers1

7

according to man rc:

The following characters are special: # ; & | ^ $ = ` ' { } ( ) < > The single quote (') prevents special treatment of any character other than itself.

So = is a special char which you need to escape.

If you don't like the syntax:

ls '--color=auto'

you can escape only the = char by:

ls --color'='auto

but I don't think it's any better.

Michał Šrajer
  • 2,808
  • 17
  • 17
  • Thank you! Unfortunately I didn't pay much attention to this part of manual, shame on me. You're right, no other way, only escaping. Also I've found that in Plan 9 OS dd tool uses traditional-style options: -if, -of and -bs instead of if=, of= and bs= and I found that great. – wobmene May 02 '12 at 08:46