simple argument passing
I am trying to pass two arguments to the script, say test.sh
by using ./test.sh abc "xyz" I want to have the double quotes captured in the variable COLUMN. i.e. the output of this script should be "xyz". How do I do that? Code:
#!/usr/bin/ksh |
Make your input to the script:
abc \"xyz\". The backslashes escape the special meaning of the quotes so they are passed in litterally. |
Is there no way that we can capture it after we pass on the arguments to the script.
Does the $2 dont take quotes at all or is it during the assignment that it gets lost?? |
for more complicated inputs, e.g. a"entry"with"several"weird"quotes"""around"
you can use the ´ single quote to pass the entire string litterally: ´a"entry"with"several"weird"quotes"""around"´ |
I want to do it after getting into the script? Is that possible?
|
It isn't because the quotes are done at the shell level. You'd have to guess and add the quotes in the script where you think it would be.
|
To guess in script I need to check whether all the characters in the argument are lower case. Could you give me a function that tells, if all the letters in the argument are lower case.
I looked in google to check for that the simple function to check lower case, but its leading to complex codes always. I want to implement this. Will it work. Code:
if [check whether $2 is all lower case] |
Hi.
I have a partially humorous suggestion. It is true as FreeDoughnut says that the quotes are removed when the shell processes a command -- at least for bash and other Bourne-shell related shells. The rc shell handles quotes differently. Here's an example of an rc script being called from an interactive rc shell: Code:
% rc The rc shell never really caught on, and the only place I saw it used much was at Thinking Machines (TMC) in Boston. However, it seems to be available in many distributions. Nice to know perhaps, but, as I said, probably not a serious solution -- and, no, I don't know much more about it than that :) See your friendly man rc page for details (and it is a pretty good man page) ... cheers, makyo |
All times are GMT -5. The time now is 02:31 AM. |