mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-04-12 21:52:58 +00:00
functions: add new helpers that create a dir and cd/pushd into it
A lot of places are currently doing: mkdir -p foo/bar cd foo/bar Or even: mkdir -p foo/bar pushd foo/bar [...] popd Provide both wrapper to ease doing this. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
parent
b990202ced
commit
c0475188cb
@ -323,6 +323,22 @@ CT_Popd() {
|
||||
popd >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Create a dir and cd or pushd into it
|
||||
# Usage: CT_mkdir_cd <dir/to/create>
|
||||
# CT_mkdir_pushd <dir/to/create>
|
||||
CT_mkdir_cd() {
|
||||
local dir="${1}"
|
||||
|
||||
mkdir -p "${dir}"
|
||||
cd "${dir}"
|
||||
}
|
||||
CT_mkdir_pushd() {
|
||||
local dir="${1}"
|
||||
|
||||
mkdir -p "${dir}"
|
||||
CT_Pushd "${dir}"
|
||||
}
|
||||
|
||||
# Creates a temporary directory
|
||||
# $1: variable to assign to
|
||||
# Usage: CT_MktempDir foo
|
||||
|
Loading…
x
Reference in New Issue
Block a user