refactor!(posix) replace pushd with cd

This commit is contained in:
Tarek Arar
2022-08-17 14:38:50 +04:00
committed by AJ ONeal
parent fbcef3e583
commit be05abb043
5 changed files with 18 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# For installing from the extracted package tmp directory
pkg_install() {
pushd "$WEBI_TMP" 2>&1 > /dev/null
cd "$WEBI_TMP" 2>&1 > /dev/null
if [ -n "$(command -v rsync 2> /dev/null | grep rsync)" ]; then
rsync -Krl ./xmpl*/ "$pkg_src/" 2> /dev/null
@@ -11,5 +11,5 @@ pkg_install() {
fi
rm -rf ./xmpl*
popd 2>&1 > /dev/null
cd 2>&1 > /dev/null
}

View File

@@ -222,7 +222,7 @@ __bootstrap_webi() {
# detect which archives can be used
webi_extract() {
pushd "$WEBI_TMP" > /dev/null 2>&1
cd "$WEBI_TMP" > /dev/null 2>&1
if [ "tar" = "$WEBI_EXT" ]; then
echo "Extracting ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
tar xf "${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
@@ -240,7 +240,7 @@ __bootstrap_webi() {
echo "Failed to extract ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
exit 1
fi
popd > /dev/null 2>&1
cd > /dev/null 2>&1
}
# use 'pathman' to update $HOME/.config/envman/PATH.env
@@ -398,23 +398,23 @@ __bootstrap_webi() {
if [ -n "$(command -v pkg_pre_install)" ]; then pkg_pre_install; else webi_pre_install; fi
pushd "$WEBI_TMP" > /dev/null 2>&1
cd "$WEBI_TMP" > /dev/null 2>&1
echo "Installing to $pkg_src_cmd"
if [ -n "$(command -v pkg_install)" ]; then pkg_install; else webi_install; fi
chmod a+x "$pkg_src"
chmod a+x "$pkg_src_cmd"
popd > /dev/null 2>&1
cd > /dev/null 2>&1
webi_link
_webi_enable_exec
pushd "$WEBI_TMP" > /dev/null 2>&1
cd "$WEBI_TMP" > /dev/null 2>&1
if [ -n "$(command -v pkg_post_install)" ]; then pkg_post_install; else webi_post_install; fi
popd > /dev/null 2>&1
cd > /dev/null 2>&1
pushd "$WEBI_TMP" > /dev/null 2>&1
cd "$WEBI_TMP" > /dev/null 2>&1
if [ -n "$(command -v pkg_done_message)" ]; then pkg_done_message; else _webi_done_message; fi
popd > /dev/null 2>&1
cd > /dev/null 2>&1
echo ""
fi

View File

@@ -5,7 +5,7 @@ set -u
main() {
webi_download
pushd ~/Downloads/webi 2>&1 > /dev/null
cd ~/Downloads/webi 2>&1 > /dev/null
if [ "Darwin" = "$(uname -s)" ]; then
curl -fsSL 'https://gist.githubusercontent.com/coolaj86/8c36d132250163011c83bad8284975ee/raw/5a291955813743c20c12ca2d35c7b1bb34f8aecc/create-bootable-installer-for-os-x-el-capitan.sh' -o create-bootable-installer-for-os-x-el-capitan.sh
@@ -28,7 +28,7 @@ main() {
echo "Created ~/Downloads/el-capitan.iso"
echo ""
popd 2>&1 > /dev/null
cd 2>&1 > /dev/null
}
main

View File

@@ -23,9 +23,9 @@ __init_powershell() {
mv ./* "$pkg_src"
# symlink powershell to pwsh
pushd "$pkg_src" > /dev/null
cd "$pkg_src" > /dev/null
ln -s pwsh powershell
popd > /dev/null
cd > /dev/null
}
pkg_link() {

View File

@@ -4,7 +4,7 @@ set -u
__rmrf_local() {
if [ -d "${HOME}/.local/opt" ]; then
pushd "${HOME}/.local/opt" 2>&1 > /dev/null
cd "${HOME}/.local/opt" 2>&1 > /dev/null
rm -rf \
arc \
archiver \
@@ -95,8 +95,8 @@ __rmrf_local() {
# exceptions (may lose data)
#postgres \
#postgresql \
popd 2>&1 > /dev/null
pushd "${HOME}/.local/bin" 2>&1 > /dev/null
cd 2>&1 > /dev/null
cd "${HOME}/.local/bin" 2>&1 > /dev/null
rm -f \
arc \
archiver \
@@ -188,7 +188,7 @@ __rmrf_local() {
# exceptions (may lose data)
#postgres \
#postgresql \
popd 2>&1 > /dev/null
cd 2>&1 > /dev/null
fi
}