I get these error messages. Can someone please help me?
andyk_~/Downloads$ Show_Percent_Reserved_Blocks.sh
/home/andy/bin/Show_Percent_Reserved_Blocks.sh: line 2: Block: command not found
/home/andy/bin/Show_Percent_Reserved_Blocks.sh: line 3: Reserved: command not found
syntax error at -e line 1, near "/ )"
Execution of -e aborted due to compilation errors.
Would you not be better with something else then, such as:-
#!/bin/bash
read a b block_count < <(grep -i "block count" list_tune.txt | grep -iv reserved)
read a b reserved_block_count < <(grep -i "reserved block count" list_tune.txt)
echo "\$block_count=\"$block_count\""
echo "\$reserved_block_count=\"$reserved_block_count\""
echo
perl -e "printf(\"%.1lf%%\n\", ($reserved_block_count * 100.0 ) / $block_count);"
Does that help a bit? This tries to read your input file and assign the variables before calling the perl command in a single script without trying to automate a code-writer/runner, which are notoriously difficult to assure.