Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-07-2014, 08:26 PM   #1
LQ Newbie
Registered: May 2014
Posts: 1

Rep: Reputation: Disabled
Updating Path via a Variable

Hi all,

I'm attempting to teach myself Linux, and I've started off with a simple exercise of creating a shell that would allow a user to navigate between a parent directory and two sub directories.

In the shell script, I would like to update the path as the user toggles between directories. An idea of what I'd like to accomplish is below:

You Are Here: /Parent Directory/Child Directory

1. Press 1 to move to the Parent Directory
2. Press 2 to view files
3. Press 3 to read a file
4. Press 4 to Exit

I've been able to browse files/read files in the directory via the shell script, but for the life of me I can't get the path at the top to update correctly after pressing 1 (Moving to the Parent Directory).

I've attempted to use cd .. command in the shell with the $pwd variable, but no matter what I try I just can't get it to work appropriately.

Does anyone have any suggestions?

Old 05-08-2014, 02:31 AM   #2
LQ Addict
Registered: Dec 2013
Posts: 5,802

Rep: Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380Reputation: 1380
if you'd show us the actual script, we might be able to help you solve it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange bash completion behavior when using path with ' (apostroph) in PATH variable mallniya Linux - Newbie 3 02-05-2014 12:41 AM
Add path to $PATH variable alaios SUSE / openSUSE 2 04-19-2009 08:41 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
Path Variable answerme Linux - Newbie 6 04-19-2008 02:35 AM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration