Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
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. –  khrf May 2 '12 at 8:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.