In your question, you say that the *name* of the folder can be upper- or lower case, so I guess this is just an example, where only the first letter of the folder name can be upper- or lower case.
A bash or ksh wildcard expression of all possible folder places for the script would be
If there would be exactly one path matching this expression, you are done. However, in my experience, if you are working in an environment where you can't even predict the upper/lower case of the letters in a directory entry, you will sooner or later find a situation where you have both /u/myfolder/.... and, say, /u/MyFolder/...
Hence I would first store the list of all pathes matching this expression into an array, and if the array size is not equal one, I would abort with an error message.
I can state categorically that if the following are true:
there is one and only one file that matches the shell pathname matching pattern /u/[Mm]yfolder/scripts/test.sh ,
the pathname that matches that pattern is a regular file,
the permissions on the pathname that matches that pattern allows execution by the person entering the following command, and
the command /u/[Mm]yfolder/scripts/test.sh argument1 is typed into a bash or ksh interactive shell at a shell prompt; is entered as a simple command in a valid, non-interactive bash or ksh shell script; and all of the commands in that script are valid on all systems on which you are running that script
then the command will work on both a Solaris system and on a Linux system. If any of the above conditions are not met, there is no way that we can guess at which of the above conditions is causing your attempts to fail with what you have shown us.
Likely problems would include specifying Linux specific options to one or more commands in the script the you are executing that are not valid on your Solaris system, that you have specified a path in the script that you are executing that is valid on your Linux system but is not valid on your Solaris system, or giving that pathname matching pattern to something other than a shell that uses Bourne shell syntax.
With all of the details that you have hidden from us, there is no way for us to tell you what you need to do to fix your problem.
since the string /u/myfolder/scripts/test.sh is not one of the valid arguments that the command /u/Myfolder/scripts/test.sh is expecting and it only wants one operand; not the two operands that you are giving it.
Although there are two paths i can see that the lower case one [myfolder] is getting called. the Issue now is with regards to be able to pass the argument which is failing.
i wanted a one line command solution if possible else, i will go for a if condition check script.
---------- Post updated at 05:34 AM ---------- Previous update was at 05:32 AM ----------
Got it !! Understood. So i guess there is no one line solution.
While the maximum line length of a bash command line depends on the operating system where bash is running, I am not aware of systems where this length would be less than 32000. Hence, you can make any bash script a one-liner, as long as it has not more than this number of characters; you just have to replace every newline by a semicolon.