for i in *.jpg
do
j = '$i | cut -d . -f 1'
convert $i $j".png"
done
temp.sh: line 3: j: command not found
I know about mogrify, just wanted to know how to get variables done in bash.
temp.sh: line 3: j: command not found I know about mogrify, just wanted to know how to get variables done in bash. |
|||
|
|
|
You have to remove the spaces around
|
|||||||||
|
|
You can also use bash's builtin parameter expansion to remove the first dot and everything after it: If you want to remove the last dot and anything following it (i.e. the file's extension), use: Example:
|
|||
|
|
In addition, your script won't work as expected if any filename contains any special character (such as a space). You should get in the habit of always enclosing variable references in double quotes. Try this:
|
|||||
|