• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

Shell scripting

How do I remove control characters from a shell script command-line argument

A shell script is automatically invoked with a total of 9 command-line arguments. One argument is being received with an angled bracket embedded in the text - example follows:

Firewall PIX port 3 denied access > MAC unknown

Angled bracket is being processed as a redirect character and a file named "MAC unknown" is created

So, how do I remove angled bracket from command-line argument???

0
viborg86
Asked:
viborg86
1 Solution
 
ahoffmannCommented:
depends on your shell, for example you have your characters in variable $arg1
# (t)csh syntax
   $arg1:q
# sh and friends
  "$arg1"
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now