Bash: Checking for lower case and upper case letters in a string
So I have a case in my bash script or well a few that I need to check if a word is typed in any combination of upper and/or lower case letters (trust me I don't want to do "Back" | "BACK" | "back" | so on for every combination of upper and lower case characters of every thing that would add quite the length to my script.
Not only do I need this in case statements also need to be able to in an if statement where I compare the string "delete" and "Delete" and "DELETE" and so on to a variable.
why I'm so picky about this is when I name a file with anything thats the same word just different case it throws an error to the user and plus I also for ease of use want this. I would appreaciate some help on this as I'm struggling to find a simple answer.
I believe those are the only two situations I need this in thank you ahead of time you guys are great to me :)
oh and changing the variable before the rest of my script to all lowercase or uppercase isn't gonna cut it :P unless i ABSOLUTELY have to
found solution for if statements doing the whole [Aa][Bb] thing I was doing it wrong so it failed but now that works
if I do this to the case statement though things go very wrong when I type quit it exits...the terminal not just the script like it should :P any ideas? and funny thing is where I found this solution that worked for if statements the example on the site is a case statement :P yet it don't work :P before this test quit did exactly as it should btw
also another detail I would like to avoid shopt -u nocasematch if at all possible again it isn't gonna cut what I want but I may consider it since I believe I found a part of my script that if may have no choice but would like avoid it in the case section please if at all possible
so in a test I just did I found case isn't working because well I'm not sure yet but it wasn't the regex expressions :D so now to find whats wrong. but if anyone care to explain how useful shopt can be I'm listening but I'll be in a moment when I fix this look it up myself but any opinions? :) thanks
Just discovered the issue it's in the way I run the script. How can I make it if I run the script with . filename that when I do an exit 0 it doesn't quit the terminal too? ./filename doesn't do this nor does a symlink running it which probably be the main way of running the script but still I need it to not do this if it is to be run that way. Any ideas :D
all in all with no replies on this in time I have managed to fix this file up and have a couple bugs I wish to bring up I've found and see if anyone can help me but that is for another post this one is messy :P
|All times are GMT -5. The time now is 09:21 AM.|