Linked Questions

3 votes
3 answers
6k views

I frequently have to cd from $HOME to a particular long directory path. So I thought I'd put a cdscript in $HOME to make getting there a little quicker. cdscript: #!/bin/sh directory="/some/big/long ...
Escher's user avatar
  • 523
2 votes
2 answers
7k views

I was wondering if it's possible to change directory of a shell from a bash script, but keep the directory change persistent to more than just the subshell. I'm aware that when you run cd inside a ...
kamziro's user avatar
  • 141
0 votes
2 answers
1k views

I made this script: #!/bin/bash if [[ $# -ne 1 ]]; then echo "only use one argument" exit 1 fi mkdir $1 sleep 0.5 cd $1 exit 0 I wanted to make a script that I would later put into /usr/bin, ...
iamAguest's user avatar
  • 553
0 votes
1 answer
2k views

How would you arrange for a shell script to be executed in a child process, while still being able to change the current directory of the invoking shell?
Ms.Sahin's user avatar
-2 votes
1 answer
2k views

File name: Test.sh #!/bin/bash ZDir="$(echo /usr/src)" cd "$ZDir" When I execute the script ./Test.sh, the command cd doesn't do anything.  If I try to do it directly in the bash terminal, it works ...
Raul Chiarella's user avatar
0 votes
1 answer
1k views

Here is my script to change the directory [user@linux ~]$ cat script.sh echo Before: $(pwd) cd "$1" echo After : $(pwd) [user@linux ~]$ When I tested it, it did not really change the directory as ...
user11392987's user avatar
1 vote
1 answer
1k views

When i run the script: #!/bin/bash DRUPAL_ROOT=$(drush status root --format=list) if [ -z $DRUPAL_ROOT ] then echo -e "Not exists Drupal core" else echo $DRUPAL_ROOT cd $DRUPAL_ROOT fi Output: ...
Mariano Gutiérrez's user avatar
3 votes
1 answer
476 views

I made a very simple script #!/bin/bash mkdir $1 && cd $1 when I execute myscript test It creates test directory but doesn't go inside just after. I don't understand why, on my fedora 27 ...
vdegenne's user avatar
  • 1,816
-2 votes
1 answer
299 views

here is a small test I ran, to try and move me back to root: #!/bin/bash pwd cd / pwd It returns the current working directory, and then the correct new one, but when the script finished executing, I ...
CYQ00000A's user avatar
0 votes
1 answer
521 views

I'm trying to make a bash script that will give me a command that will take a number n as argument and change the directory to the nth directory listed by running ls in the working directory. Here's ...
Lewis Theobald's user avatar
0 votes
0 answers
44 views

I have a script that I need to run an application which, at the end, changes the working directory. (I'm modifying an ".sh" script and am new to Unix.) I then need to run some commands in that new ...
VenerableAgents's user avatar
0 votes
1 answer
41 views

I'm currently at /opt and running a small shell script. My "no" condition works perfectly, however, my yes condition doesn't work, I 'am still at /opt. while true; do read -p "go to log location ?...
Pragnya Kolagotla's user avatar
0 votes
0 answers
19 views

forgive me, the title was hard to come up with as i'm not even sure how to ask this any other way. i have a script that moves it's contents and then nukes the remains. here's the script (works just ...
WhiteRau's user avatar
  • 255
0 votes
0 answers
16 views

I was working on a script to set up a project-specific environment. I created a script to set up the directory stack as suggested in the first comment to this question. Console output provided ...
2NinerRomeo's user avatar

15 30 50 per page