Skip to content
Snippets Groups Projects
Commit a12c0bab authored by Florian Meißner's avatar Florian Meißner
Browse files

Added helper script for watchman

Added test script which shows behaviour of bash parameters
parent d9ead858
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
echo '$1:'$1
echo '$2:'$2
echo '$3:'$3
echo '$@:'$@
echo '"$@":'"$@"
#!/bin/bash
# this generates a nicely formatted commit message for auto-commit
# put changed files as params
commit_msg=$'auto-commit\n\nchanges in:\n'
# if no arguments are given, insert placeholder
if [[ $# -eq 0 ]]; then commit_msg=$commit_msg$'\t-- no changes detected --';
else
# loop over arguments (by shifting to the left)
while [[ $# -ne 0 ]] ; do
# $'' for c-style escape sequences
commit_msg+=$'\t- '$1$'\n'
shift
done
fi
# add everything to git
git add -A
# commit with message from stdin to preserve format
git commit -F - <<< "$commit_msg"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment