How to execute command+parameters in a Linux C Shell script

Posted on 2011-10-31
Medium Priority
Last Modified: 2012-05-12
I would like to incorporate the following in my C Shell script.
packager --input-file=G:\Testing\test.txt --output-path=G:\Testing\out.txt duration=4

“Packager” is an executable command from a third party program. –input  and –output are parameters that can be passed to “Packager”

How do I execute the command and parameters  form a C Shell script?
What’s the correct syntax ?

Please bear in mind that this is just a part of a bigger C Shell script
Question by:wademi
  • 4
  • 3
LVL 68

Expert Comment

ID: 37059259
The statement is nearly correct.
Just escape the backslashes with a second one or put single quotes around the parameters ('--input-file...'

Author Comment

ID: 37059266
But how does c chell know that packager is an actual command
LVL 68

Expert Comment

ID: 37059282
The shell will search for it in your PATH if it's not a shell builtin or a shell syntax element (which it isn't).

To be really sure you could add the full path (/path/to/packager)
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 37059312
so just enter the command as is in my C Shell script?


path/packager `--input-file=G:\Testing\test.tx`t `--output-path=G:\Testing\out.tx`t `duration=4`
LVL 68

Expert Comment

ID: 37059316
By the way - Linux does not use Windows-style paths as in your Q.
Where did you get them from?

Author Comment

ID: 37059349
I know the path is different. I have to do this project in both linux and windows. was the above sytax correct using / slash
LVL 68

Accepted Solution

woolmilkporc earned 2000 total points
ID: 37059407
An absolute path starts with a slash.

/path/packager '--input-file=G:\Testing\test.txt' '--output-path=G:\Testing\out.txt' 'duration=4'

Please use just single quotation marks ( 'apostrophe' ) not accents or the like.

Or do it this way:

/path/packager --input-file=G:\\Testing\\test.txt  --output-path=G:\\Testing\\out.txt  duration=4

Note: No quotes, but double backslashes.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month16 days, 10 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question