-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce usage of `cd' to avoid issues with shell aliases
Since we run in interactive context the builtin `cd' may have been aliased to print some additional info when invoked, thus it's safer for us to avoid parsing the output from subshells which calls it. For instance in .bash_profile I have the following function to redefine `cd' such that it will list the destination directory contents: cd () { builtin cd "$@" && ls -F --color=auto }
- Loading branch information
Showing
1 changed file
with
37 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42915fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The right fix would be to call
\cd
instead of justcd
in order to bypass aliases.42915fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I agree with that - aliasing
cd
is problematic anyways.42915fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, being sourced in is problematic anyways, see https://gist.github.com/datagrok/2199506
42915fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't
command cd ...
universal?42915fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nb.
command
makes sure the system executable is used instead of an alias.