Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script improvement - args' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script improvement - args
Authored by: Lutin on Nov 08, '05 07:06:10AM
Thought I would share my improvement of the launcher script. It handles better all the args passed to the command.

#!/bin/sh                                                                                                                                                                             
                                                                                                                                                                                      
APP=`echo -n $0 | sed s:"__":" ":g | sed s:".*/":"": | sed s:".app":"": `                                                                                                             
                                                                                                                                                                                      
if [ "$#" -eq 0 ]; then                                                                                                                                                               
  echo $APP                                                                                                                                                                             
  open -a "$APP"                                                                                                                                                                    
else                                                                                                                                                                                  
  while [ $# -gt 0 ]; do                                                                                                                                                            
      echo $APP $1                                                                                                                                                                  
      open -a "$APP" $1                                                                                                                                                             
      shift;                                                                                                                                                                        
  done                                                                                                                                                                              
fi
I also added -f to the ln command in the generate script, to force the creation if the link already exists.

[ Reply to This | # ]