Sample Header Ad - 728x90

Change directory to execute a script

-4 votes
1 answer
282 views
In my script I create a directory and need to execute subsequent commands within the directory. The below script creates a directory, but the next script it invokes (repo init) does not get executed within that directory. mkcdir () { echo "creating directory" $1 mkdir -p -- ~/"$1" && cd -P -- ~/"$1" } mkcdir $1 repo init -u git@github.com:P0/manifest.git -b refs/tags/$1 repo sync
Asked by user1050619 (745 rep)
Aug 5, 2017, 12:44 PM
Last activity: Aug 6, 2017, 05:11 AM