Solved csh - Alias with a space

August 23, 2012 at 04:41:50
Specs: Windows 7, 2GB
I'm trying to make mkinfo interpret "mkfifo --mode=777" as "mkfifo -m 777" so it can run based off a command that PS3 Media Server is throwing and subsequently failing at. Is there a way to to do this? Should I use an alias?

See More: csh - Alias with a space

Report •

August 23, 2012 at 17:53:57
✔ Best Answer
You can set up a csh alias like this:

alias mkfifo /home/nails/sandbox/sct30/mymkfifo

where the mkfifo command executes the script .../sct30/mymkfifo script instead of the /usr/bin/mkfifo program.

Here is the mymkfifo script:

# script: mymkfifo

# parse everything to the right of the equal sign: field 2
set myarg=`echo "$1"|/bin/awk ' BEGIN { FS="=" } { print $2 } '`

/usr/bin/mkfifo -m $myarg
# end script

The script assumes one command line argument is passed. In this case it's:


The awk script parses what is to the right of the equal sign. Then an absolute call to /usr/bin/mkfifo with the proper args executes.

Keep in mind:

First, change the paths to the myfifo script, and change paths to awk and mkfifo if different.

Second, your environment has changed with regards to mkfifo. Obviously, any other process that calls mkfifo might have a problem.

In closing, I do not like to alias normal unix commands. But in this case, I do not see an alternative.

Let me know if you have any questions.

Report •

August 24, 2012 at 15:56:09
/usr/bin/mkfifo -m $myarg $2

That worked for me. Also, I had to rename mkfifo to something random, I chose xmkfifo and named the script mkfifo. I suspect that PMS uses a direct path to mkfifo and it was failing to run properly. This is working fine now. Well, there are other issues but it has to do with PMS itself and not the script you wrote.

Thanks a lot for your help!

Report •
Related Solutions

Ask Question