Bash
Code
Pipe output to file:
ls > output.txt
Save current Date in variable:
now=${date}
Print variable:
echo ${now}
Check if local git repo has changes:
if \[\[ \`git status --porcelain\` \]\]; then
echo 'CHANGES'
else
echo 'NO CHANGES'
fi
Two different ways to write if statements:
- with semicolon before then:
if [ "Test" != 'Test' ]; then
echo '💬'
else
echo '💬'
- with no semicolon and new line before then
if [ "Test" != 'Test' ]
then
echo '💬'
else
echo '💬'