Views:
503
Votes: 1
✅ Solution
Tags:
bash
scripts
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/834794
Title:
Run script defined in PATH location in the current shell
ID:
/2016/10/09/Run-script-defined-in-PATH-location-in-the-current-shell
Created:
October 9, 2016
Edited: October 10, 2016
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
Based on new information in the OP this answer has been changed.
In your script you need to push the directory you want to end up in when the script finishes:
rick@dell:/$ cat /usr/local/bin/windows
pushd /boot/grub > /dev/null
ls
When you call the script you must but a dot and space in front of it .
like this:
────────────────────────────────────────────────────────────────
rick@dell:/$ . windows
fonts grub.cfg grubenv locale zapgrub.cfg
gfxblacklist.txt grub.cfg~ i386-pc unicode.pf2
────────────────────────────────────────────────────────────────
rick@dell:/boot/grub$
Above is simple example of how calling . windows
containing the push
command works instead of calling windows
containing cd
command.
For your script you need to change cd "$mount_point"/Users/Justin
to pushd "$mount_point"/Users/Justin
and call the script with . windows
instead of windows