Learn faster and stay on-track by joining this free class with other self-learners.
|
Bash ScriptingClass length: 18 weeks. Start anytime. Creator: kday Status: Established |
Join this class! |
|
Lesson 5: Assignment 1Read chapter 6 and do the examples. Homework Submissions3 total/usr/bin/env shre="([a-zA-Z ]) - ([0-9]) - (.*)$" while read cdtrack; do if [[ "$cdtrack" =~ $re ]]; then echo Track ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]} fi done < tracks.txt The cookbook does not say this because it predates the version 3.2, but using quotes in RHS in =~ makes it a string comparison rather than a regex match. That is why RE needs to be stored in a variable first. Complete No comments. Sign up or log in to comment I "graded" myself ahead of time, while I'm reading the chapter I thought I would post some things I thought where interesting:
No comments. Sign up or log in to comment |
No comments. Sign up or log in to comment