![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to delete trailing zeros from a variable | Chandu2u | Shell Programming and Scripting | 16 | 05-09-2008 01:47 AM |
| dots and slashes | DarkLord | UNIX for Dummies Questions & Answers | 1 | 01-27-2007 01:35 AM |
| spaces trimming while assigning to a variable | Lokesha | SUN Solaris | 2 | 06-07-2006 02:09 AM |
| Strip leading and trailing spaces only in a shell variable with embedded spaces | jerardfjay | Shell Programming and Scripting | 6 | 03-07-2005 02:24 PM |
| Password slashes. | hellz | UNIX for Dummies Questions & Answers | 4 | 11-30-2001 11:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
trimming trailing slashes in variable
I'm using this thread as an example, but can't seem to apply it to my situation.
I'm trying to strip the trailing slash (/) from an input argument. Here's a snippet of my command line input and the troublesome code: Code:
$ script_name -s "../pathname/dir/"
snip 8< ...
while getopts :s: FLAGNAME
do
case $FLAGNAME in
s) start_dir=$OPTARG
start_dir=`echo "${start_dir}" | sed ` s/[^\/]\/+$ //``
echo $start_dir # should be ../pathname/dir
;;
h) echo "Wrong syntax"
exit 1
;;
done
|
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|