Hello. I know there are similar topics here, but to be honest I didn't find solution for my problem. I've also checked stackoverflow but no result.
I have to make a bash script that will be changing files' names from lower to upper OR from upper to lower via parameters in command line. So when I put in command line:
./bashScript lower upper
then all files in directory should change from lower to upper case.
I have to also add 3rd parameter that will let me change only one specific file. So for example I have to be able of putting in command line:
./bashScript lower upper fileName
I've created something like this:
#!/bin/bash if test "$1" = "lower" && test "$2" = "upper" then for file in *; do if [ $0 != "$file" ] && [ $0 != "./$file" ]; then mv "$file" "$(echo $file | tr [:lower:] [:upper:])"; fi fi done elif test "$1" = "upper" && test "$2" = "lower" then for file in *; do if [ $0 != "$file" ] && [ $0 != "./$file" ]; then mv "$file" "$(echo $file | tr [:upper:] [:lower:])"; fi done fi
But this is not working at all. And I don't know how to make this 3rd parameter for one specific file. I'd be grateful if anyone could write a code or add to my code proper issues.
Thank you in advance.