Last active
August 29, 2015 14:03
-
-
Save scvnc/742418def384679cc065 to your computer and use it in GitHub Desktop.
Bash file loop screenshare sesssion tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in *.md; do | |
# Execute: basename ${file} ".md" | |
# and store the result in name | |
name=$(basename ${file} ".md") | |
# In bash, you can refer to variables like this: | |
# $name or ${name}. I prefer the latter because in this | |
# text-crazy scripting environment it can be useful to identify | |
# explicitly which pieces are variables. | |
# Example: | |
# Print the contents of the variable $noun against the word 'cave' | |
# If noun="bat" then the result should be: batcave | |
# If noun="rat" then the result should be: ratcave | |
# echo $nouncave (will not work) | |
# echo ${noun}cave (works) | |
echo "The filename is ${file}" | |
echo "it's basename is ${name}" | |
# blank line | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment