Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ksh - Reading/evaluating contents of input string for special characters

Status
Not open for further replies.

gawker

Programmer
Feb 21, 2002
34
0
0
US
Greetings.

This is a question about the ksh environment.

Let's say that I want to evaluate a path name provided to my script as shown here: ./test.ksh /tmp/user-data/stuff

This prior example is straight forward as there isn't anything that needs to be interpreted. The script variable shows exactly what was used during the script invocation.

Now suppose the data provide was something messy such as: ./test.ksh /tmp/user-data\/st$uf#f

As you can see, the data contains a "\", "$" and "#". The script sees the data as: /tmp/user-data/st#f , having lost the "\" and "$" as they were parsed accordingly.

Is there a way to read the input so that the script sees exactly what was presented, including any and all special characters?

Any help would be appreciated.

G
 
A starting point:
Code:
./test.ksh [!]'[/!]/tmp/user-data\/st$uf#f[!]'[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you very much PHV, that does work.

In my haste in rewritting my post, I neglected to state the requirement that quotes and such were not to be used on the data. I thought about quotes, but that isn't typically something one would use, so enforcement would be a whole different problem.

Regards,

G

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top