Register
It is currently Tue Jul 29, 2014 2:41 am

Prevent the command prompt from stripping '\' characters


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Fri Oct 03, 2008 11:53 pm   

Joined: Fri Oct 03, 2008 10:50 pm
Posts: 3
Is there a way to do this? I want to be able to convert windows style paths to posix form, however every time the variable is read in, the echoed variable shows no '\'. So instead of "C:\path" converting to C:/path it becomes C:path. Here's a whittled down version of the script:


Code:
#! /usr/bin/bash

select choice in "change_directory"
do
    change_directory)
            read -p"Enter new directory: " directory
            ${directory//\\/\//}
            cd "$directory" && echo "new dir: '$directory' "
    break;
done


Top
 Profile  
 PostPosted: Sat Oct 04, 2008 8:07 pm   

Joined: Fri Oct 03, 2008 10:50 pm
Posts: 3
read -r: the -r allows for backslashes.

gofig, I spend 2 days looking for something this simple ...javascript:emoticon(':roll:')
Rolling Eyesfound


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP