LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Updating Path via a Variable (https://www.linuxquestions.org/questions/linux-newbie-8/updating-path-via-a-variable-4175504277/)

bcc860 05-07-2014 08:26 PM

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.

ondoho 05-08-2014 02:31 AM

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


All times are GMT -5. The time now is 09:07 PM.