'Case shell command not working in terminal
Trying to figure out operating system to run a command in my package. Found this :
case "$OSTYPE" in
solaris*) echo "SOLARIS" ;;
darwin*) echo "OSX" ;;
linux*) echo "LINUX" ;;
bsd*) echo "BSD" ;;
msys*) echo "WINDOWS" ;;
*) echo "unknown: $OSTYPE" ;;
esac
I receive : The term 'case' is not recognized as the name of a cmdlet, function, script file, or operable program
But if I run this within a file "sh test.sh" it shows the correct system to terminal.
My operating system is windows. The question is why is the error being received when i run in the terminal and not from the file? And is there any way a case command to run in a script to figure out the operating system?
Solution 1:[1]
It looks like that comes out of a UNIX shell script.
You are running windows.
if you are trying to run that thing with cmd, you're gonna have a bad time.
However, you could install a copy bin /bin/sh on your windows box. Such miracles happen these days. Even the crippled operating systems can have a decent shell!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nobody Tells The Truth |