Bash Quirkiness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bash is astonishingly fussy about spacing and punctuation.

Here's a (admittedly very inelegant) snippet of code to automatically
generate exploit abuse complaints from a cron job.

while read evil freq ; do
	if [ "$freq" -gt 250 ] ; then
		a=`host $evil`
		c=`expr "$a" : '.*\(\..*\.net\)'`
		evilisp=${c/\./abuse\@}
			if [ $evilisp > "0" ] ; then
. . . . .

Note the use of both ' and ` in the line with the "expr." I find that
they are not interchangeable. Assigning a variable to an 'expr' will not
work without the "`". In fact, I cut and pasted it from some web docs.
I'm not even really sure what character it is. 

Can someone point me to documentation that fully explains this
punctuation issue?  Yes, I know that there are alternatives like awk and
perl but I would like to understand the bash issue.




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux