Skip to content

Instantly share code, notes, and snippets.

@mnemnion
Created July 16, 2016 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnemnion/ed8222f767638a57e9ec6a8185848383 to your computer and use it in GitHub Desktop.
Save mnemnion/ed8222f767638a57e9ec6a8185848383 to your computer and use it in GitHub Desktop.
Simple Bash functions: file -> .file, and .file -> file
#lazyfuncs for dotting and undotting stuff
function dt {
for file in "$@"; do
if [[ ${file:0:1} != "." ]]
then mv $file ".$file"
else echo "$file is already dotted"
fi
done
}
function undt {
for file in "$@"; do
if [[ $file != ".." && $file != "." ]]
then
if [[ ${file:0:1} == "." ]]
then mv $file ${file:1}
else echo "$file is not a dotted file"
fi
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment