1
java -jar yuicompressor-2.4.2.jar

~/src/yuicompressor-2.4.2/build$ ls
yuicompressor-2.4.2.jar

Usually, I have to be in that directory to run this command. Is there any way I can set it so that I can run this command anywhere in my box?

Alex
  • 8,111
  • 24
  • 71
  • 99

2 Answers2

2

try this:

cd ~/src/yuicompressor-2.4.2/
JAR=`pwd`/yuicompressor-2.4.2.jar
JAVA=`which java`
echo "$JAVA -jar $JAR" > yuicompressor.sh
chmod +x yuicompressor.sh
sudo ln -s yuicompressor.sh /bin/yuicompressor.sh

now you (and other users) should be able to run yuicompressor.sh from anywhere

rytis
  • 2,324
  • 1
  • 18
  • 13
0

you could make an alias:

alias yuicomp=java -jar yuicompressor-2.4.2.jar

you would need to put the full path in asw ell I think

matpol
  • 318
  • 1
  • 5