LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-07-2014, 09:26 PM   #1
bcc860
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?

Thanks.
 
Old 05-08-2014, 03:31 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,760
Blog Entries: 3

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


Reply


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 01:41 AM
Add path to $PATH variable alaios SUSE / openSUSE 2 04-19-2009 09:41 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 06:48 PM
Path Variable answerme Linux - Newbie 6 04-19-2008 03:35 AM
$path variable ? moby Linux - Newbie 3 06-01-2004 04:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 PM.

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