Skip to content

Commit 2ed8fc5

Browse files
committed
Use ${PWD} instead of $(pwd)
Don't subshell when there's a shell parameter for it.
1 parent 30ddc4d commit 2ed8fc5

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

completion/available/hub.completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ EOF
227227
((c++))
228228
done
229229
if [ -z "$name" ]; then
230-
repo=$(basename "$(pwd)")
230+
repo="$(basename "${PWD}")"
231231
fi
232232
case "$prev" in
233233
-d|-h)

lib/helpers.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ _bash-it-restart() {
449449
_about 'restarts the shell in order to fully reload it'
450450
_group 'lib'
451451

452-
saved_pwd=$(pwd)
452+
saved_pwd="${PWD}"
453453

454454
case $OSTYPE in
455455
darwin*)

plugins/available/dirs.plugin.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ alias 8="pushd +8"
2323
alias 9="pushd +9"
2424

2525
# Clone this location
26-
alias pc="pushd \$(pwd)"
26+
alias pc='pushd "${PWD}"'
2727

2828
# Push new location
2929
alias pu="pushd"
@@ -73,7 +73,7 @@ G () {
7373
example '$ G ..'
7474
group 'dirs'
7575

76-
cd "${1:-$(pwd)}" ;
76+
cd "${1:-${PWD}}" ;
7777
}
7878

7979
S () {

themes/base.theme.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function svn_prompt_vars {
344344
# - .hg is located in ~/Projects/Foo/.hg
345345
# - get_hg_root starts at ~/Projects/Foo/Bar and sees that there is no .hg directory, so then it goes into ~/Projects/Foo
346346
function get_hg_root {
347-
local CURRENT_DIR=$(pwd)
347+
local CURRENT_DIR=${PWD}
348348

349349
while [ "$CURRENT_DIR" != "/" ]; do
350350
if [ -d "$CURRENT_DIR/.hg" ]; then

themes/powerturk/powerturk.theme.bash

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ _swd(){
4343
begin="" # The unshortened beginning of the path.
4444
shortbegin="" # The shortened beginning of the path.
4545
current="" # The section of the path we're currently working on.
46-
end="${2:-$(pwd)}/" # The unmodified rest of the path.
46+
end="${2:-${PWD}}/" # The unmodified rest of the path.
4747

4848
if [[ "$end" =~ "$HOME" ]]; then
4949
INHOME=1

0 commit comments

Comments
 (0)