Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    East Coast of South Africa
    Posts
    10

    Unanswered: return verable's contents as a verable. How?

    Hello all,
    Scenario: bash, #of days in year into verable and I want to use in find.

    Sample:
    #!/bin/bash
    three=`date '+%j'`
    two=`expr $three + 365`
    one=`expr $two + 365`

    todir='/usrdata/history/working'

    for i in $(echo one two three)
    do
    out="outfile$i"
    touch $out
    find /usr4/daten -mtime +$("$i") >>$out
    while read bla
    do
    echo $bla
    #more command here for moving data
    done < $out
    done

    Fault: the -mtime should read -mtime +"value for each verable"

    How do I do this pleeeezz.
    Last edited by EZEE!; 10-16-03 at 11:22.

  2. #2
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    12
    Do a
    for i in $one $two $three
    instead of
    for i in $(echo one two three)
    Thanks and Regards
    Karthik R

  3. #3
    Join Date
    Oct 2003
    Location
    East Coast of South Africa
    Posts
    10

    Not altogether there yet!

    Further along... the road.


    I am looking at using the verable name as a filename and the contents of the verable as the find criteria.
    IE, lets say the verable 'three' contains the value 2554

    I want the result >> into a file called 'three'
    and the find command mist use -mtime +2554

    so:
    find . -mtime2554 > three.txt is what I want
    and this is similar to how I want to get it abut I know there are errors.


    one='expr 3333'
    two='expr 3000'
    three='expr 2554'

    for i in $(echo one two three)
    do
    find . -mtime$i > $i.txt
    done

    Any ideas without having to use case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •