Results 1 to 3 of 3
  1. #1
    Join Date
    May 2011
    Location
    Pune(India)
    Posts
    32

    Answered: Unix command to list out the files with secific input.

    Hi,

    I am having list of below files.

    test1.txt
    test2.txt
    test3.txt
    test4.txt
    test5.txt
    test6.txt
    test7.txt
    test8.txt
    test9.txt
    test10.txt

    And I want the combination of commands that will generate output like below.

    chmod 777 test1.txt
    chmod 777 test2.txt
    chmod 777 test3.txt
    chmod 777 test4.txt
    chmod 777 test5.txt
    chmod 777 test6.txt
    chmod 777 test7.txt
    chmod 777 test8.txt
    chmod 777 test9.txt
    chmod 777 test10.txt


    I have tried using
    $ echo "chmod 777 "|ls *.txt

    But its showing "chmod 777" only one time.

    Regards
    Gopal Pawar
    --
    Thanks
    Gopal Pawar

  2. Best Answer
    Posted by kitaman

    "
    Code:
    for file in *.txt
    do
       echo "chmod 777 " $file
    done
    "


  3. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Code:
    for file in *.txt
    do
       echo "chmod 777 " $file
    done

  4. #3
    Join Date
    May 2011
    Location
    Pune(India)
    Posts
    32
    Thank you it's ok
    --
    Thanks
    Gopal Pawar

Posting Permissions

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