INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close