LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command line arguments containing ( (https://www.linuxquestions.org/questions/linux-newbie-8/command-line-arguments-containing-390465/)

Lotharster 12-08-2005 06:06 AM

command line arguments containing (
 
I'd like to pass a string that contains brackets '(' as a command line argument to a script, like e.g.
Code:

$ calc f(x)
But there's a bash error:
bash: syntax error near unexpected token `('
I know that I can use '\(', but this can become quite cumbersome when using many brackets. Is there a better way?

phil.d.g 12-08-2005 06:27 AM

wrap the arguments in quotes?
Code:

calc "f(x)"

Thymox 01-05-2006 07:51 AM

Ofcourse, if it is the result of the calc statement that you wanted passed as an argument to another command, you could wrap the whole thing in left-hand quotes:
Code:

$ newcommand `calc f(x)`

pixellany 01-05-2006 08:43 AM

si the calc function expecting a string similar to "f(x)"? If so, then simply use the parantheses.
Otherwise, let us know what calc expects.....


All times are GMT -5. The time now is 04:20 PM.