This is a continuation of what started off as a few questions
here and
here for a script i've been working on, i've had final exams since then so had to drop it for a while, I worked out the last problems and now have a few new ones.
here is my script so far.
Quote:
#! /bin/sh
originalname=Dock\ Clicker
execfile=$(basename "$0")
execdir=$(dirname "$0")
cd "$execdir"
cd ../../
appname=$(basename $PWD)
#number=the number in between the () in $appname
#newnumber= $number plus 1
#name= the text before the () in $appname
name=Dock\ Clicker
prepwd=$(dirname "$PWD")
prepwd=$prepwd/
newpath="$prepwd""$name"\ \("$newnumber"\).app
mv "$PWD" "$newpath"
exit 0
The main problem i need to work out is how to get $appname (something like "Dock Clicker (5).app") split into the stuff before the (5).app ($name) and stuff between the () ($number)
If it helps, the purpose of this script is to be the executable file for a cocoa bundle that increments a number in it's name every time it is executed.
Any other suggestions for enhancements on the rest of the script would be welcome also :-)