Skip to content
Snippets Groups Projects
Verified Commit 31d3e969 authored by Maxime Ripard's avatar Maxime Ripard
Browse files

completion: Only run cd if .dim-last-path exists


We currently always cat .dim-last-path and cd to whatever content it
has.

However, it's not guarantee to exists, so the initial cat might not
work. Make sure we only switch to it if the file exists in the first
place.

Suggested-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Maxime Ripard's avatarMaxime Ripard <mripard@kernel.org>
parent b4f17a81
No related branches found
No related tags found
1 merge request!18dim: Move dim-last-path path definition to a variable
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
dim () dim ()
{ {
if [[ "$1" = "cd" ]]; then if [[ "$1" = "cd" ]]; then
cd $(cat ~/.dim-last-path) || return 1 if [ -e "~/.dim-last-path" ]; then
cd $(cat ~/.dim-last-path) || return 1
else
return 1
fi
else else
command dim "$@" command dim "$@"
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment