Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: rigstars2
  • Content: Threads
  • Order by date
  1. rigstars2

    linux nested for loops HELP ..

    Hello all, Need some help here .. country=(argentina brazil china) for (( i=0; i < ${#country[i]}; i++ )); do for init in $(cat ~/files/zones.txt); do echo ${country[i]} `cat ~/lists/$init.zone| wc -l` done done #desired output argentina 2000 brazil 400 china 5000 #wrong output I...
  2. rigstars2

    bash script bad substitution error message

    Each item in the list is an associated array. I'm trying to traverse each key/value from each associated array. Error message I get ... ${!$x[@]}: bad substitution I tried substituting with backticks and quotations .. aaList=( aa1 aa2 aa3 ) for x in "${aaList[@]}" do for KEY in...
  3. rigstars2

    shell Associate Array not printing out all elements

    #!/opt/local/bin/bash THRESHOLD=0 SUBJECT_HOURLY="'Hourly'" SUBJECT_DAILY="'Daily'" DAILY=`df -h | grep -i "/Volumes/Daily" | awk '{print $5}' | sed "s/%//"` HOURLY=`df -h | grep -i "/Volumes/Hourly" | awk '{print $5}' | sed "s/%//"` declare -A MyArray MyArray=( [$HOURLY]=$SUBJECT_HOURLY...
  4. rigstars2

    bash for loop help - nested?

    I'm trying to create a loop or I believe in this case nested for loops but the logic escapes me. Can someone please assist here? My logic looks way off here .. for ip in $(cat $ZONES_PATH/br.zone ); do ipset -A brazil $ip; done for ip in $(cat $ZONES_PATH/cn.zone ); do ipset -A china $ip; done...
  5. rigstars2

    comparing 2 arrays for invalid mac addresses only

    I have 2 arrays and I want to compare and only print the non-valid macs in red/bold. The valid macs array will always be constant. I tried comparing 1 element at a time but doesn't work as it would still pick up valid array elements. Any help would be appreciated. valid macs 90:40:95:29:C4:81...
  6. rigstars2

    netstat foreign address code help?

    I'm trying to massage code so that if it finds any ip address(except 0.0.0.0) in the foreign address column it will print out "foreign address found" right now, it is printing "foreign address found" due to $5 being a column .. the default ip in column $5 is 0.0.0.0:* if there is an easier...
  7. rigstars2

    rsync with hardlinks rotating snapshots code

    Hello everyone, I’m curious to know if my code is working as designed? The first hourly.0 performs a full backup then every snapshot after (hourly.1 —> hourly.11 afterwards is hardlinked. Now here is the part I’m confused. During one of the runs, I’ll get a full backup performed again on...
  8. rigstars2

    regex help multiple pattern extensions

    Hello, I can't seem to get my regex right to print out bot the .xml and .zip file. I've been working on this for hours. Can someone please assist this old timer. Thanks in advance. Doing this on a mac os x system if that matters any. find . -regex "./DC18B[0-9]*\(.zip|.xml\)" -print find ...
  9. rigstars2

    bash nested loop not working?

    Struggling here to get both IPs in my arr1 to be blocked going to the URLs listed in arr2 In the future, I'd like to expand arr1 to add more IPs if needed. Can someone please assist with my code below? Thanks in advance. #!/bin/sh arr1="192.168.1.12 192.168.1.14" arr2="facebook.com...
  10. rigstars2

    regex help

    need help with my regex, it is only matching the first line. I need it to match all the entries below. regex ----- /bsordertrack\s*[Cannot update assessment event for cannot find Pearson Order Removed empty].*\n|[PEARSON0109]/ matching text ------------- bsordertrack cannot find Pearson...
  11. rigstars2

    bash script store array1 contents into new array problem

    for ((i = 1; i <= 9; i=)); do VAR=`sudo launchctl list | grep ${List[i-1]}` >/dev/null 2>&1 if [ "$VAR = "" ]; then ${List2[i-1]} = List[i-1] <---- the error says =: command not found ..what is wrong with my syntax echo "${List2[i-1]}" fi done
  12. rigstars2

    bash shell function commands not executing ..?

    This function is supposed to receive a variable $CON and start a service. I tested it and so I know the function is processing the $CON variable however, when I check the service, it was still down. If run the last line in the function by itself in commandline, it starts the service fine. Do I...
  13. rigstars2

    base script case statement error

    i get a syntax error..end of file error.. where is the error in my case statment? thanks case "$CON" in [Ee][1]) funct1 $CON ;; [Dd][1]) funct2 $CON ;; *) echo " Error: Invalid argument..."...
  14. rigstars2

    bash script parameter passing into command

    I'm calling my script like this: ./processName wws2 below is my syntax, how can I use the argument I'm passing to this command below..doesn't seem to like it being passed in as a parameter? There is a syntax error? Please assist. Thanks! VAR=`ps -ef | grep apdel | awk '/$1/ {print $10}' | cut...
  15. rigstars2

    bash script error message if else

    Here is a snippet of my bash code ..can't seem to figure out the error I get; however, if I comment out the first 2 if statements ..it runs fine ..the error I get is "syntax error: unexpected end of file", points the last line if [[ $# -eq 0 || $# -gt 1 ]] && usage if [[ $1 != "process1" || $1...
  16. rigstars2

    inserting variables within my awk statement

    Here is a snippet of my awk statement..I'm trying to insert these 2 variables in the statement but they are not getting evaluated. Can someone point me in the right direction? ZONE=`date "+%Z %Y"` DAY=`date "+%a"` awk '{if (NR<2) {print "["$1, $2, $3"]"}}' I'v tried this: awk '{if (NR<2)...
  17. rigstars2

    combine 2 bash commands into single line

    Hey guys, Can you please help me solve this problem. These statements run fine on their own but I'd like to combine them into one. I can't seem to get it to work. Any guidance would be great. Thanks! # First statement egrep -w 'Deny TCP|Deny UDP' $FW_LOG | awk '{print $1 " " $2 " " $3}' >>...
  18. rigstars2

    directories with spaces using diff command

    Hey Everyone, ORIGINAL="Library/Internet Plug-Ins" COPY="/MyStuff/watch/Internet Plug-Ins" The ORGININAL directory has extra files there so when I run the command below, I'd expect it the find the differences between the 2 variables but it doesn't. Any help is appreciated. I'm thinking, it is...
  19. rigstars2

    nested if/else error in bash script

    Hey guys, Can't find the error in my nested if/else. Please help. error I get is - line 56: syntax error near unexpected token `then' line 56: `else [ "$LOCATION" = "HomeFi" ]; then' LOCATION=$(networksetup -getcurrentlocation) if [ "$LOCATION" = "Rental" ]; then host google.com...
  20. rigstars2

    add signature after attachments in the body email

    (uuencode ~/LogSize.txt ~LogSize.html ; uuencode ~/Services.txt ~Services.html ; uuencode ~Denies.txt ~Denies.html ; eval echo $SIGNATURE) | mail -s "$SUBJECT" $MAILTO Can't seem to append a signature to the body of the email. Any ideas? The attachments get sent fine but without signature. Help...

Part and Inventory Search

Back
Top