Detecting unused variables...


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Detecting unused variables...
# 1  
Old 05-13-2016
Detecting unused variables...

Hi guys...

The first active code line in AudioScope.sh is set -u .
This causes a complete exit if a variable is used/found but has not been allocated at the start of the program.

However, apart from writing code to do the task, is there a switch to to check which variables have been allocated but have not been used in the remainder of the code?

I have checked the WWW and there is nothing. I have also read the bash manual and can't see any reference.

iMac, OSX 10.11.4, bash version:-

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.

Thanks In Advance...
# 2  
Old 05-13-2016
Maybe it helps to grep out the variable assignments from your script?
Here is a clumsy attempt:
Code:
script=yourscript
perl -pe 's/.*?([[:alpha:]]\w*)=/$1\n/g; s/[^\n]*$//' $script

Then try to find the $var references in a loop, and print if not found
Code:
for var in `perl -pe 's/.*?([[:alpha:]]\w*)=/$1\n/g; s/[^\n]*$//' $script | awk 'NF>0 && s[$0]++==0'`
do
  grep '\${\{0,1\}'"$var"'\>' $script >/dev/null || echo "$var"
done

Yet it does not know if a var= is within a 'string' or "string" i.e. is not an assignment in the shell...
This User Gave Thanks to MadeInGermany For This Post:
# 3  
Old 05-14-2016
Hi.

Found in Debian repository (noted by Is there a static analysis tool like Lint or Perl::Critic for shell scripts? - Stack Overflow ):
Code:
#!/usr/bin/env bash

# @(#) s1       Demonstrate static shell checking.
# If not in repository, see:
# http://hackage.haskell.org/package/ShellCheck
# ( Verified 2016.05.14 )

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
# export PATH="/usr/local/bin:/usr/bin:/bin"
LC_ALL=C ; LANG=C ; export LC_ALL LANG
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C shellcheck

FILE=${1-data1}

pl " Input data file $FILE:"
cat $FILE

pl " Results:"
shellcheck $FILE

exit 0

producing:
Code:
$ ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 3.16.0-4-amd64, x86_64
Distribution        : Debian 8.4 (jessie) 
bash GNU bash 4.3.30
ShellCheck - shell script analysis tool

-----
 Input data file data1:
#!/bin/bash

# @(#) example1.sh      Demonstrate catching of errors.

v0=7

for i in 1 2 3
do
  (( l=j+1 ))
  printf " Hello, world (from script)"
done

if [ $v1 ]
then
  echo ' My fault'
fi

exit $n

-----
 Results:

In data1 line 5:
v0=7
^-- SC2034: v0 appears unused. Verify it or export it.


In data1 line 7:
for i in 1 2 3
^-- SC2034: i appears unused. Verify it or export it.


In data1 line 13:
if [ $v1 ]
     ^-- SC2086: Double quote to prevent globbing and word splitting.


In data1 line 18:
exit $n
     ^-- SC2086: Double quote to prevent globbing and word splitting.

Best wishes ... cheers, drl
These 4 Users Gave Thanks to drl For This Post:
# 4  
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...
# 5  
Old 05-18-2016
Quote:
Originally Posted by wisecracker
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.
Backwards compatible with what? It's already meant for bash, so I assume you mean sh... You store binary data in shell variables -- I wouldn't trust that to work in anything but brand-name BASH, and very modern BASH at that.

The problems it flags with printf are all legit, btw. What would happen if your binary data included a meaningless % character, just incidentally? printf would bomb, that's what, because % is not meaningless to printf. printf "%s" "$data" avoids that problem.
This User Gave Thanks to Corona688 For This Post:
# 6  
Old 05-18-2016
Quote:
Originally Posted by wisecracker
However, apart from writing code to do the task, is there a switch to to check which variables have been allocated but have not been used in the remainder of the code?
You already have been given very good advice here, so there is little for me to add - which is why i can as well quit pretending to be helpful and start to outright annoy you:

i think you tackle this from the wrong side alltogether!

Every software engineer learns about structured programming and its values and writing reusable pieces of code, yada, yada. But as every experienced software engineer can tell you structurisation - that is, breaking down the code to simple functions - is not only about reusing pieces of code and all the other tenets. One of its greatest benefits is that it breaks down long parts of the code into small manageable "chapters".

A former colleague of mine, principal senior coder in a large software project, even opined that a function - any function - that is longer than a screen full (he uses the same 80x40 xterm windows i prefer) should be broken down into parts, if not for anything else than for clarity of reading. Now, i think this strict stance is a bit of throwing the baby out with the bath water, but i can understand his sentiment. I try to apply this to my shell scripting all the time and - apart from a few exceptions, like commandline handling in scripts with many options - my functions are mostly fitting on one page of the 80x40 xterm i prefer.

Now, shell programming allows for a lot of bad behavior: undeclared variables made out of thin air, no real distinction between locals and globals and so on. I try to always work as strict as possible, meaning:

if i use a variable, i write a "typeset"-statement declaring it, using "typeset -i" if i intend to use it as an integer.

I admit publicly here that i am a devout user of Hungarian Style Notation, adapted to my needs as a shell programmer: i use, for instance, "f" as a prefix for file/directory names, even if there is no real datatype of a "path", whereas strings that can contain whatever are prefixed "ch" ("char" obviously). I also use "l" for switches, even though they are integers but should only contain 0 or 1. But it doesn't matter so much what you use: be consistent with yourself! If you use UPPERCASE for variables (personally i hate that, but that is just me) then ALWAYS use it - not sometimes this way and sometimes the other.

I ALWAYS stay away from that handy "export" keyword and the dot-feature (. command) - save for a few carefully selected exceptions. If a function needs a certain value from another function calling it, it has to be in the parameters. This way - usually even before i write that function - i have its "interface": which parameters it needs, which return values it produces, which output it creates - already laid out.

So, to sum it up: if you have thousands of lines of code and cannot keep track of your variables i suppose you should do a major code review and rewrite the parts where you needed a variable-tracker in the first place. After some serious restructuring of the code the need for such tools might just go away.

I hope this helps (ahh well, see above).

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
# 7  
Old 06-05-2016
Hi all...
(Apologies for the delay but I have had other commitments. Also for any typos.)

@bakunin...
(Have you tried the code out at all to see what it does?)

1) I am not a software engineer, but a retired, mere amateur. ;o)
2) This project was for me to learn shell scripting, of which I know much more now than day one.
3) There are many functions inside the program that can't really be made simpler than they are and there are also some simple ones called regularly.
4) There are a lot of variables and all are used, there are no extras that have been found. I like _bash_'s flexibiilty and things that It, along with the Terminal, can do makes life interesting. Along the way I have discovered some strange effects of the hardware that I and I suspect nearly everyone else did not know.
5) Lastly a rewrite of the code would be difficult as it has evolved to become a tool that even I could not have imagined - back at the start of this project I bragged about doing this but never in my wildest dreams did I expect it to get where it is. It HAS had a write up in Linux Format Magazine and this is a shock to the system to say the least.
6) Fimally this script does everything EXCEPT build the external hardware for you...
A) Although unfinished, contains the circuits; so far.
B) Generates ALL necessary files plus have extras that you can use elsewhere as .WAV files.
C) Creates a working Audio Oscilloscope using text mode inside a terminal without the need for fancy graphics.
D) Uses 3 dedicated capture modes, along with 3 other modes that are platform specific.
E) Uses ONLY the mic/ear socket of an MBP 13 inch OSX 10.7.5 using the default bash terminal.
F) It has evolved over time.
G) And LBNL, I don't think this has ever been attempted anywhere elsebefore.
H) Capable of doing both AC and DC measurements to a minimum of 4 - 5 bit depth.
I) Other things that elude me at the moment.

It is designed to run on hopefully UNIX, definitely various Linux flavours in both 32 and 64 bit guises, CygWin and CygWin64 and MBP/iMac OSX 10.7.x minimum.

So to finalise, you have not annoyed me but it would be very difficult to start again with my current knowledge so I am coding this in its original coding style.

A listing of the files generated for the current version:-
Code:
-rw-r--r--  1 barrywalker  wheel  48000  5 Jun 13:14 0000000000.BIN
-rwxr--r--  1 barrywalker  wheel    503  5 Jun 13:14 1KHz-Test.sh
-rw-r--r--  1 barrywalker  wheel  80272  5 Jun 13:15 AudioScope.Manual
-rw-r--r--  1 barrywalker  wheel    327  5 Jun 13:15 AudioScope.config
-rw-r--r--  1 barrywalker  wheel    253  5 Jun 13:14 VERT_BAT.BAT
-rw-r--r--  1 barrywalker  wheel    295  5 Jun 13:14 VERT_DSP.sh
-rw-r--r--  1 barrywalker  wheel    336  5 Jun 13:14 VERT_SOX.sh
-rw-r--r--  1 barrywalker  wheel      1  5 Jun 13:14 dcdata.raw
-rw-r--r--  1 barrywalker  wheel  65580  5 Jun 13:15 pulse.wav
-rw-r--r--  1 barrywalker  wheel  65580  5 Jun 13:14 pulse1.wav
-rw-r--r--  1 barrywalker  wheel  65580  5 Jun 13:14 pulse2.wav
-rwxr-xr-x  1 barrywalker  wheel      1  5 Jun 13:14 pulsetest.sh
-rw-r--r--  1 barrywalker  wheel  48000  5 Jun 13:14 sample.raw
-rw-r--r--  1 barrywalker  wheel      1  5 Jun 13:14 signed16bit.txt
-rw-r--r--  1 barrywalker  wheel  65536  5 Jun 13:14 sinewave.raw
-rw-r--r--  1 barrywalker  wheel  65580  5 Jun 13:14 sinewave.wav
-rw-r--r--  1 barrywalker  wheel   8000  5 Jun 13:14 squarewave.raw
-rw-r--r--  1 barrywalker  wheel  65096  5 Jun 13:14 sweep.raw
-rw-r--r--  1 barrywalker  wheel  65140  5 Jun 13:14 sweep.wav
-rw-r--r--  1 barrywalker  wheel  32548  5 Jun 13:14 sweeper.raw
-rw-r--r--  1 barrywalker  wheel   8000  5 Jun 13:14 symmetricalwave.raw
-rw-r--r--  1 barrywalker  wheel  48000  5 Jun 13:15 waveform.raw
-rw-r--r--  1 barrywalker  wheel  65580  5 Jun 13:14 waveform.wav

@Corona688...
OK, maybe backwards compatibilty is not the phrase to use, however I do test on various platforms. Several Linux flavours using live DVDs, iMac and MBP, CygWin and CygWin64 of which the latter did show up a bug NOT even related to printf . I have even used the 'printf' inside /usr/bin/printf which does NOT allow escaped hex values but only octal ones but decided that the hex ones looked neater.

I would like professional opinions on trying it out in their UNIX flavours however, even if you don't like it.

And finally the variables are all used and none are detected as not being allocated during program run.

I hope this clears it up and the next upload will be the AC condition finalised with builds and calibration of the AC vertical axis.

The DC conditions will be much harder, Arduino and the first home built 'ALTDC' are done and coded for but not calibrated yet.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. AIX

how to clean Unused semaphore??

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

7. 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

8. 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

9. 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
Login or Register to Ask a Question