An entire array can be assigned by enclosing the array items in parenthesis:
arr=(Hello World)
arr[0]=Hello
arr[1]=World
${arr[*]} # All of the items in the array ${!arr[*]} # All of the indexes in the array ${#arr[*]} # Number of items in the array ${#arr[0]} # Length of item zero
GIT
squash commits
git commit --amend --no-edit --all && git push --force-with-lease
git reset
git rm --cached -r .
git reset --hard
Update local branch with master changes
git checkout mybranch # gets you "on branch mybranch"
git fetch origin # gets you up to date with origin
git merge origin/master
Tag commits
git ls-remote --tags origin
git tag -a 1.3.3 -m "bump to version 1.3.3"
git push --tags
read a file line by line
while read LINE; do
# Do what you want to $LINE
done < filename
Uptime check
URL=gadban.de
while true; do echo -n "$(date '+%Y%m%d_%H:%M:%S') - "; curl -o /dev/null -s -S -m3 -w "Total: %{time_total}s Response:%{http_code}\n" $URL ; sleep 30.9; done
1 Comment
thx