Sponsored Content
Top Forums UNIX for Advanced & Expert Users Detecting unused variables... Post 302973099 by wisecracker on Saturday 14th of May 2016 08:56:20 AM
Old 05-14-2016
Hi MadeInGermany...

I have no knowledge of Perl so will have study the syntax.
I did try your two code snippets however and it didn't seem to pick out variables, whether in stand alone or string mode, as a single occurence of said 'string' "var=".

I was expecting to write code but got sample code written for me. Thanks...

Hi drl...

Just come on so not had time to look at and try your code snippets as yet.
I don't intend to alter my style of coding from my very first post of AudioScope.sh even though it may look a little primitive now. I have the bash -n filename switch to check the syntax and that is all I need here.

However as MadeInGermany has suggested 'var=' could be anywhere in any line of the code; but so long as there is only one of them then that particular 'var=' can be considered redundant. I will also check to see if there are two of the said variable(s) just in case there is a reference to a redundant variable inside a comment.

Thanks both so far...

---------- Post updated at 01:56 PM ---------- Previous update was at 01:22 PM ----------

Well used......

ShellCheck – shell script analysis tool

......and it gave these results.
Code:
$ shellcheck myscript
 
Line 53:
version=" \$VER: AudioScope.sh_Version_"$ver"_2013-2016_Public_Domain_B.Walker_G0LCU."
                                        ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 136:
cygwin=`uname`
       ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 146:
printf "$data" >> /tmp/sinewave.raw
       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 164:
printf "$data" >> /tmp/pulse1.wav
       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 174:
printf "$data" >> /tmp/pulse2.wav
       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 182:
        printf "$data" >> /tmp/0000000000.BIN
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 194:
for wave_form in {0..999}
^-- SC2034: wave_form appears unused. Verify it or export it.
 
Line 196:
        printf "$data" >> /tmp/squarewave.raw
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 250:
printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh
^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 286:
echo -e -n '@ECHO OFF\r\n' >> /tmp/VERT_BAT.BAT
^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 305:
printf '#!/bin/bash\n' >> /tmp/VERT_SOX.sh
^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 310:
printf '        printf "$data" >> /tmp/squarewave.raw\n' >> /tmp/VERT_SOX.sh
       ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
 
Line 329:
printf '#!/bin/bash\n' >> /tmp/VERT_DSP.sh
^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 334:
printf '        printf "$data" >> /tmp/squarewave.raw\n' >> /tmp/VERT_DSP.sh
       ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
 
Line 347:
printf "\x1B]0;Shell AudioScope Version "$ver".\x07"
       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                         ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 363:
        read -n1 -s -t$1
        ^-- SC2162: read without -r will mangle backslashes.
                      ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 400:
        cd /tmp
        ^-- SC2164: Use cd ... || exit in case cd fails.
 
Line 401:
        SoundRecorder.exe \/FILE waveform.wav \/DURATION 0000:00:02
                          ^-- SC1001: This \/ will be a regular '/' in this context.
                                              ^-- SC1001: This \/ will be a regular '/' in this context.
 
Line 402:
        cd ~
        ^-- SC2164: Use cd ... || exit in case cd fails.
 
Line 409:
        . /tmp/AudioScope.config
        ^-- SC1091: Not following: /tmp/AudioScope.config was not specified as input (see shellcheck -x).
 
Line 417:
        printf "demo=$demo\n" >> /tmp/AudioScope.config
        ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 418:
        printf "drawline=$drawline\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 419:
        printf "sound_card_zero_offset=$sound_card_zero_offset\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 420:
        printf "scan_start=$scan_start\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 421:
        printf "scan_jump=$scan_jump\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 422:
        printf "scan_end=$scan_end\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 423:
        printf "setup='$setup'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 424:
        printf "save_string='$save_string'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 425:
        printf "foreground=$foreground\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 426:
        printf "timebase='$timebase'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 427:
        printf "vertical='$vertical'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 428:
        printf "polarity=$polarity\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 429:
        printf "capturemode='$capturemode'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 430:
        printf "capturepath='$capturepath'\n" >> /tmp/AudioScope.config
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 463:
        printf "$graticule"
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 499:
                rm $HOME/Movies/*.aifc > /dev/null 2>&1
                   ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 550:
                        vert=`hexdump -n1 -s$subscript -v -e '1/1 "%u"' /tmp/waveform.raw`
                             ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 553:
                        vert=`od -An -N1 -j$subscript -tu /tmp/waveform.raw`
                             ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 558:
                        vert=$[ ( 255 - $vert ) ]
                             ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 561:
                vert=$[ ( $vert + $sound_card_zero_offset ) ]
                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 571:
                vert=$[ ( ( $vert / 16 ) + $vert_shift ) ]
                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 581:
                subscript=$[ ( $subscript + $scan_jump ) ]
                          ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 584:
                printf "\x1B[1;37;44m\x1B["$vert";"$horiz"f*"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                           ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                   ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 606:
                subscript=$[ ( $subscript + 1 ) ]
                          ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 609:
                number=$[ ( $vert_two - $vert_one ) ]
                       ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 621:
                                vert_one=$[ ( $vert_one - 1 ) ]
                                         ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 624:
                                        printf "\x1B[1;37;44m\x1B["$vert_one";"$horiz"f*"
                                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                                   ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                                               ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 625:
                                        vert_one=$[ ( $vert_one - 1 ) ]
                                                 ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 630:
                                vert_one=$[ ( $vert_one + 1 ) ]
                                         ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 633:
                                        printf "\x1B[1;37;44m\x1B["$vert_one";"$horiz"f*"
                                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                                   ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                                               ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 634:
                                        vert_one=$[ ( $vert_one + 1 ) ]
                                                 ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 648:
        printf "\x1B[0;37;40m\x1B[22;3f$blankline\x1B[22;4f"
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 651:
                printf "\x1B[0;$foreground;40mStopped...\x1B[0;37;40m"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 655:
                printf "Running \x1B[0;32;40m$scan\x1B[0;37;40m of \x1B[0;32;40m$scanloops\x1B[0;37;40m scan(s)..."
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 667:
                printf "Synchronisation set to \x1B[0;32;40m$sync_point\x1B[0;37;40m$synchronise..."
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 675:
                printf "\x1B[0;33;40m$zoom\x1B[0;37;40m"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 679:
                printf "Horizontal shift, scan start at position \x1B[0;32;40m$scan_start\x1B[0;37;40m..."
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 683:
                printf "Symmetrical waveform frequency is \x1B[0;32;40m"$freq"\x1B[0;37;40m Hz..."
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                                        ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 691:
                printf "$char"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 696:
                printf "\x1B[23;3f$version\x1B[20;14f"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 712:
        read -p "Press <CR> to (re)run, HELP or QUIT<CR>:- " -e kbinput
        ^-- SC2162: read without -r will mangle backslashes.
 
Line 742:
                break
                ^-- SC2104: In functions, use return instead of break.
 
Line 771:
                capturepath=`ls /dev/dsp 2>/dev/null`                
                            ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 783:
                        printf "\x1B[0;31;40m\x1B[22;3f$blankline\x1B[22;4fThe device /dev/dsp does not exist, switching back to DEMO mode...\x1B[20;14f"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 797:
                printf "\x1B[0;37;40m\x1B[22;3f$blankline\x1B[22;4fPlease wait while SOX is found, this \x1B[0;31;40mMIGHT\x1B[0;37;40m take a \x1B[0;31;40mLONG\x1B[0;37;40m time...\x1B[20;14f"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 800:
                capturepath=`find ~ -name 'sox' 2>/dev/null`
                            ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 802:
                char=`which sox 2>/dev/null`
                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 818:
                        printf "\x1B[0;31;40m\x1B[22;3f$blankline\x1B[22;4fThe SOX audio device was not found, switching back to DEMO mode...\x1B[20;14f"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 833:
                capturepath=`ls /usr/bin/osascript 2>/dev/null`
                            ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 845:
                        printf "\x1B[0;31;40m\x1B[22;3f$blankline\x1B[22;4fThe MAC audio device was not found, switching back to DEMO mode...\x1B[20;14f"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 859:
                capturepath=`SoundRecorder.exe \/FILE waveform.wav \/DURATION 0000:00:02 > /dev/null 2>&1`
                            ^-- SC2006: Use $(..) instead of legacy `..`.
                                               ^-- SC1001: This \/ will be a regular '/' in this context.
                                                                   ^-- SC1001: This \/ will be a regular '/' in this context.
 
Line 872:
                        printf "\x1B[0;31;40m\x1B[22;3f$blankline\x1B[22;4fThe Windows audio device was not found, switching back to DEMO mode...\x1B[20;14f"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 884:
                capturepath=`ls /usr/bin/arecord 2>/dev/null`
                            ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 896:
                        printf "\x1B[0;31;40m\x1B[22;3f$blankline\x1B[22;4fThe ALSA audio device was not found, switching back to DEMO mode...\x1B[20;14f"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 941:
                read -p "Set timebase starting point. From 0 to $scan_end<CR> " -e tbinput
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 954:
                str_len=$[ ( ${#tbinput} - 1 ) ]
                        ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 961:
                        number=`printf "%d" \'$number`
                               ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 963:
                        if [ $number -le 47 ]
                             ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 968:
                        if [ $number -ge 58 ]
                             ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 988:
                read -p "Set timebase user speed. From 1 to $[ ( ( ( $scan_end - $scan_start ) / 64 ) + 1 ) ]<CR> " -e tbinput
                ^-- SC2162: read without -r will mangle backslashes.
                                                            ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 998:
                str_len=$[ ( ${#tbinput} - 1 ) ]
                        ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1005:
                        number=`printf "%d" \'$number`
                               ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1007:
                        if [ $number -le 47 ]
                             ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1012:
                        if [ $number -ge 58 ]
                             ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1026:
                number=$[ ( ( ( $scan_end - $scan_start ) / 64 ) + 1 ) ]
                       ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1031:
                printf "\x1B[0;37;40m\x1B[22;4fScan start at offset \x1B[0;32;40m$scan_start\x1B[0;37;40m, with a jump rate of \x1B[0;32;40m$scan_jump\x1B[0;37;40m."
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1215:
                        read -p "Vertical shift:- U for up 1, D for down 1, <CR> to RETURN:- " -n 1 -s vshift
                        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1223:
                                vert_shift=$[ ( $vert_shift + 1 ) ]
                                           ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1227:
                                vert_shift=$[ ( $vert_shift - 1 ) ]
                                           ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1238:
                        printf "\x1B[23;3f Vertical shift is \x1B[0;32;40m$[ ( 2 - $vert_shift ) ]\x1B[0;37;40m from the mid-point position...                        "
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                                          ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1262:
                scan_start=$[ ( $scan_start + 1 ) ]
                           ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1274:
                        break
                        ^-- SC2104: In functions, use return instead of break.
 
Line 1277:
                read -p "Set trigger type, <CR> to disable:- " -e kbinput
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1287:
                                        grab=`hexdump -n1 -s$subscript -v -e '1/1 "%u"' /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                            ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1290:
                                        grab=`od -An -N1 -j$subscript -tu /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1292:
                                if [ $grab -eq $sync_point ]
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1302:
                        for subscript in $( seq $scan_start $scan_end )
                                                ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1306:
                                        grab=`hexdump -n1 -s$subscript -v -e '1/1 "%u"' /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                            ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1309:
                                        grab=`od -An -N1 -j$subscript -tu /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1311:
                                if [ $grab -lt 128 ]
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1321:
                        for subscript in $( seq $scan_start $scan_end )
                                                ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1325:
                                        grab=`hexdump -n1 -s$subscript -v -e '1/1 "%u"' /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                            ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1328:
                                        grab=`od -An -N1 -j$subscript -tu /tmp/waveform.raw`
                                             ^-- SC2006: Use $(..) instead of legacy `..`.
                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1330:
                                if [ $grab -gt 128 ]
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1349:
                        read -p "Set trigger polarity, +, - or <CR>:- " -e char
                        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1353:
                        printf "\x1B[23;3f$setup"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1373:
                                ext_trig_array=(`hexdump -v -e '1/1 "%u "' /tmp/waveform.raw`)
                                                ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1379:
                                                if [ ${ext_trig_array[$count]} -eq $sync_point ] && [ ${ext_trig_array[$[ ( $count + 1 ) ]]} -gt $sync_point ]
                                                                                                                       ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1386:
                                                if [ ${ext_trig_array[$count]} -eq $sync_point ] && [ ${ext_trig_array[$[ ( $count + 1 ) ]]} -lt $sync_point ]
                                                                                                                       ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1410:
                savefile=`date +%s`'.BIN'
                         ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1411:
                cp /tmp/waveform.raw /tmp/$savefile
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1445:
                savefile=`date +%s`'.BIN'
                         ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1446:
                cp /tmp/waveform.raw /tmp/$savefile
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1451:
                read -p "Enter the filename ONLY, not the path:- " -e kbinput
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1453:
                if [ "$kbinput" == "`ls $kbinput`" ]
                                    ^-- SC2006: Use $(..) instead of legacy `..`.
                                        ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1455:
                        cp $kbinput /tmp/waveform.raw
                           ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1473:
                read -p "Press <CR> to continue:- " -n 1
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1493:
                        read -p "Horizontal shift, press L, l, R, r, (Q or q to exit):- " -n 1 -s kbinput
                        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1503:
                                        scan_start=$[ ( $scan_start + 64 ) ]
                                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1507:
                                        scan_start=$[ ( $scan_start + 1 ) ]
                                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1511:
                                        scan_start=$[ ( $scan_start - 64 ) ]
                                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1515:
                                        scan_start=$[ ( $scan_start - 1 ) ]
                                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1595:
                        read -p "Remove Arduino if it is connected, then press <CR> to continue:- " -n 1
                        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1599:
                        read -p "Now replace Arduino, then press <CR> to continue:- " -n 1
                        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1611:
                        set -- $coupling_device
                               ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1623:
                                printf "\n\x1B[1;32mArduino board, $coupling_device found, DC facility enabled... \x1B[0m"
                                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1631:
                                printf '/* PDE code for Arduino as a single channel ADC for AudioScope.sh... */\n' >> /tmp/Arduino_9600.pde
                                ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 1665:
                read -p "Press C<CR> (CHOPPER), F<CR> (COUNTER) or V<CR> (VCO):- " -e altdc
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1693:
                printf "\x1B[0;32;40m\x1B[22;3f$blankline\x1B[22;4fGenerating the sweep.wav and sweep.raw files, please wait a few seconds...\x1B[20;14f"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1705:
                        printf "$char" >> /tmp/sweeper.raw
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1714:
                                printf "$char" >> /tmp/sweeper.raw
                                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1720:
                                printf "$char" >> /tmp/sweeper.raw
                                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1725:
                str=`cat < /tmp/sweeper.raw`
                    ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1726:
                count=$[ ( ${#str} - 1 ) ]
                      ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1729:
                        printf "${str:$count:1}" >> /tmp/sweeper.raw
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1730:
                        count=$[ ( $count - 1 ) ]
                              ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 1738:
                printf "\x1B[0;33;40m\x1B[22;3f$blankline\x1B[22;4fAll done, now sweeping from 4KHz to about 85Hz and back...\x1B[20;14f"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1764:
                read -p "5) Press <CR> and note, A, the FIRST voltage reading:- " -n 1
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1774:
                read -p "7) Press <CR> and note, B, the SECOND voltage reading:- " -n 1
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1783:
                read -p "9) Press A or B for the LOWEST voltage reading, then <CR> " -e char
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1797:
                read -p "12) Consult the manual for the full setup proceedure. <CR> to exit:- " -n 1
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 1798:
                char=`which afplay`
                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1803:
                char=`which aplay`
                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1810:
                        printf 'echo "Press Ctrl-C to Quit..."\n' >> /tmp/pulsetest.sh
                        ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
 
Line 1855:
                printf "\x1B[0;32;40m\x1B[22;3f$blankline\x1B[22;4fPlaying back the one second capture...\x1B[0;37;40m\x1B[20;14f"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 1873:
                savefile=`date +%s`'.BIN'
                         ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1874:
                cp /tmp/waveform.raw /tmp/$savefile
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 1878:
                vert_array=`hexdump -v -e '1/2 "%u "' /tmp/waveform.raw`
                           ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 1945:
        read -p "Press <CR> to continue:- " -n 1
        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1970:
        read -p "Press <CR> to continue:- " -n 1
        ^-- SC2162: read without -r will mangle backslashes.
 
Line 1994:
        read -p "Press <CR> to continue:- " -n 1
        ^-- SC2162: read without -r will mangle backslashes.
 
Line 2009:
                read -p "Sync point:- U for up 1, D for down 1, <CR> to RETURN:- " -n 1 -s sync_input
                ^-- SC2162: read without -r will mangle backslashes.
 
Line 2017:
                        sync_point=$[ ( $sync_point + 1 ) ]
                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2021:
                        sync_point=$[ ( $sync_point - 1 ) ]
                                   ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2032:
                printf "\x1B[23;3f Synchronisation point set to \x1B[0;32;40m$sync_point\x1B[0;37;40m...                                        "
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2042:
        read -p "Set ZOOM gain, (4 = maximum sensitivity), 1, 2, 3 or 4<CR> " -e kbinput
        ^-- SC2162: read without -r will mangle backslashes.
 
Line 2061:
                                vert=`hexdump -n1 -s$subscript -v -e '1/1 "%u"' /tmp/waveform.raw`
                                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2064:
                                vert=`od -An -N1 -j$subscript -tu /tmp/waveform.raw`
                                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2069:
                                vert=$[ ( 255 - $vert ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2082:
                                vert=$[ ( $vert - 64 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2083:
                                vert=$[ ( ( $vert / 8 ) + 2 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2088:
                                vert=$[ ( $vert - 96 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2089:
                                vert=$[ ( ( $vert / 4 ) + 2 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2094:
                                vert=$[ ( $vert - 112 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2095:
                                vert=$[ ( ( $vert / 2 ) + 2 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2100:
                                vert=$[ ( ( $vert - 120 ) + 2 ) ]
                                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2110:
                        subscript=$[ ( $subscript + $scan_jump ) ]
                                  ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2112:
                        printf "\x1B[1;37;44m\x1B["$vert";"$horiz"f*"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                   ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                           ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 2129:
        printf "\x1B[0;37;40m\x1B[22;3f$blankline\x1B[22;4fWorking, please wait...\x1B[20;14f"
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2153:
                rm $HOME/Movies/*.aifc > /dev/null 2>&1
                   ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 2164:
                freq_array=(`hexdump -v -e '1/1 "%u "' /tmp/symmetricalwave.raw`)
                            ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2170:
                        char=`od -An -N1 -j$subscript -tu < /tmp/symmetricalwave.raw`
                             ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2171:
                        echo $char >> /tmp/temp.txt
                             ^-- SC2086: Double quote to prevent globbing and word splitting.
 
Line 2173:
                char=`cat < /tmp/temp.txt`
                     ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2192:
                        subscript=$[ ( $subscript + 1 ) ]
                                  ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2208:
                        subscript=$[ ( $subscript + 1 ) ]
                                  ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2223:
                freq=$[ ( $freq + 1 ) ]
                     ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2237:
                        dc_data=`hexdump -n1 -s0 -v -e '1/1 "%u"' /tmp/dcdata.raw`
                                ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2240:
                        dc_data=`od -An -N1 -j0 -tu /tmp/dcdata.raw`
                                ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2250:
                dc_data=$[ ( $dc_data * 20 ) ]
                        ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2254:
                        printf "\x1B[19;36f\x1B[1;33;40m$dc_data\x1B[0;37;40m"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2258:
                        printf "\x1B[19;35f\x1B[1;33;40m$dc_data\x1B[0;37;40m"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2263:
                        printf "\x1B[19;33f\x1B[1;33;40m$dc_data\x1B[0;37;40m"
                               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2310:
                        number=$[ ( $number + 1 ) ]
                               ^-- SC2007: Use $((..)) instead of deprecated $[..]
 
Line 2317:
                printf "\x1B[19;33f\x1B[1;33;40m$char"' Volts +DC'"\x1B[0;37;40m"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
 
Line 2372:
                        savefile=`date +%s`'.BIN'
                                 ^-- SC2006: Use $(..) instead of legacy `..`.
 
Line 2373:
                        cp /tmp/waveform.raw /tmp/$savefile
                                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

$

It found wave_form but this is used several times so not quite accurate...
As for the rest my code is designed to be as "bash" backwards compatible as is possible, and I am ignoring the 'printf' statements as errors.

I guess I could change the arithmatic and backticks to up to date methods but as I have quoted I want to keep the style as I originally learnt it, not waht I know now.

I am designing this project around a now 3 year 9 month old MBP OSX 10.7.5 and bash version:-
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.

Thanks drl for the pointer. A good find by you and extremely useful but I had no idea how to search for it...

Again thanks all...
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I get the unused space?

One of my Solaris 8 machines hd was about to die. So I used g4u to create an image of the 9gb drive and I put it in a 36gb drive. That solved my dieing hd problem. But.... How do I get my machine to see the unused 27gb of space? Any help would be greatly appreciated. (1 Reply)
Discussion started by: Spyzic
1 Replies

2. AIX

unused storage on AIX 4.3

Hi, How do I query for unused partition in AIX 4.3 with DAS and SAA storage? I know most unix administrator don't put all the capacity on the system at once. thanks, vene (1 Reply)
Discussion started by: venerayan
1 Replies

3. UNIX for Dummies Questions & Answers

delete the unused file

Hi All, Can you please let me know how to delete any files that have not been accessed in the past 28 days in a directory. Thanks, Arun (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

4. AIX

how to clean Unused semaphore??

How can i clean up my unused semaphore??? (4 Replies)
Discussion started by: abhishek27
4 Replies

5. HP-UX

HP-UX using unused HDD space

Hello, I have a system with HP-UX 11.23 installed on it. There are ~36GB of unused space on the HDD. I did a very basic installation, and it created the usual volume group /dev/vg00. When I look at the output of ioscan -funC disk, I see this (and more, but irrelevant to this post): disk ... (1 Reply)
Discussion started by: goon12
1 Replies

6. Solaris

unused disk space

i Have alloted 20G in my vmware for solaris 10, upon installation, and some distribution of disk space to /,/opt,swap i just use 19G. Can i still use the 1G? How? how to see the 1G? that i did not use? how can i use it? appreciate your responce (17 Replies)
Discussion started by: kenshinhimura
17 Replies

7. AIX

Temporarily disabling unused ethernet adapter

Hi, In our AIX 5.2 server , we have one unused ethernet adapter which doesn't have cable connection . For this interface , we are getting alerts in errpt . Could you suggesthow to stop this alert ? And sametime i would like to keep this device in ODM . Is there... (1 Reply)
Discussion started by: sekarsamy
1 Replies

8. Programming

What Unix do with unused shared memory?

Hello, When creating shared memory in C, should be remove shared memory with shmctl function when don't need it. If it didn't remove, occupied shared memory stay and remain. If we create shared memory repeatedly without removing unusable shared memory, /dev/shm will full. Does Unix or... (1 Reply)
Discussion started by: pronetin
1 Replies

9. Solaris

Solaris 10: how to disable an unused HBA card

Dear all, I have a new Oracle Blade X4-2B server, running Solaris 10. The server comes with a HBA card that will not be used now. It has not fibers connected to it. As a consequence, its leds never stop flashing. My question is: how to disable this HBA card, without removing it physically... (2 Replies)
Discussion started by: Gus1971
2 Replies
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy