Skip to content

Instantly share code, notes, and snippets.

@LaconicCode
Last active December 13, 2016 10:58
Show Gist options
  • Save LaconicCode/40e057e579d89ddb56d5ca27394f7647 to your computer and use it in GitHub Desktop.
Save LaconicCode/40e057e579d89ddb56d5ca27394f7647 to your computer and use it in GitHub Desktop.

dotfile copy script

the script
echo `hostname` | grep desktop && cp ~/.vimrc .; cp ~/.zshrc .; cp ~/.bashrc . && git add .; git commit -m "update"; git push  ||  cp -r ~/.irssi/ . && git add .; git commit -m "update"; git push
What I think should be happening is:

echo `hostname` | grep desktop && cp ~/.vimrc .; cp ~/.zshrc .; cp ~/.bashrc . && git add .; git commit -m "update"; git push

  • if the hostname "desktop" is echoed, do: cp 1; 2; 3 && git 1; 2; 3
then

|| cp -r ~/.irssi/ . && git add .; git commit -m "update"; git push

  • if a hostname other than "desktop" is entered, then do: cp -r 1; 2; 3; && git 1; 2; 3

What actually happens is both commands are executed and both files are copied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment