I program quite a bit in other languages, but am somewhat new to bash, so this may not be the most elegant program, but i'm having fun learning it!
Anyway, i put this in ~/Choices/SendTo as tar_rox In rox-filer, if you select several files or dirs and "Send To" tar_rox, it'll tar them up in the same directory w/o the entire path to the files/dirs. (any structure w/i the dir will be preserved). I have to go outside (ah!) now, but i'll add prompting for filename as a learn a bit more. Then probaly a pipe for sylpheed... The if chunk's purpose is to strip the filenames off the arguments, since they come in with full paths, and to find the path of the files (since pwd is ~/). Thought this might be of interest to some, and any bash(ing) comments are welcome! eric ------------------------------------- #!/bin/bash #xmessage $@ FILEPATH=`pwd` #will be reset to files' path if needed echo $@ | grep -q / if [ $? = 0 ] ; then FILENAMES='' for item in $@; do let count=0 if [[ `echo $item | cut -c1` = '/' ]] ; then let count=1 fi VAR='1' while [[ $VAR != '' ]]; do let count=count+1 VAR=`echo $item | cut -d/ -f$count` done FILEPATH=`echo $item | cut -d/ -f1-$((count-2))` FILENAMES=$FILENAMES` echo " "``echo $item | cut -d/ -f$((count-1))` done else FILENAMES=$@ fi echo $FILEPATH cd $FILEPATH #xmessage `tar -cvf tmp.tar $FILENAMES` tar -cvf tmp.tar $FILENAMES
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com