Skip to content

Instantly share code, notes, and snippets.

@richimf
Last active December 10, 2018 17:24
Show Gist options
  • Save richimf/807f103c9e5e18149d08e11836b1430b to your computer and use it in GitHub Desktop.
Save richimf/807f103c9e5e18149d08e11836b1430b to your computer and use it in GitHub Desktop.
CopyScripts SH to terminal

Create your SH code:

#!/bin/bash
echo "Stash App Code..."
cd <YOUR_PATH>
branchName=$(git branch | grep \* | cut -d ' ' -f2)
if [[ $branchName != *"fatal"* ]]; then
echo -e "You are on branch: "$branchName
echo "Let's save your work... /o.o/"
read -p "   > Enter Stash Name: " stash_Name
# if var is empty
if [ -z "$stash_Name" ]
then
echo "_Nothing was entered :c, try again."
else
echo "Adding all files to Stash..."
git add .
stashIdentifier=$stash_Name
echo "stashing... : "$stashIdentifier
git stash save stashIdentifier
echo "*** Done :) ***"
fi
fi

Copy to default Directory

First, change its permissions.

chmod 755 myScript

cp myScript.sh /usr/local/bin/myScript

Run

Your type on terminal:

myScript

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