+ Reply to Thread
Results 1 to 2 of 2

Thread: Bash script problem

  1. #1
      Moderator
    Good Guru
    Schotty
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,758

    Bash script problem

    I am looking at automating unzipping some files I have in directories. I am having a problem getting thru dumb characters in the filename, like spaces and dashes.

    for i in ls *7z; do 7za -y e $i; done

    This fails at those special cases. What do I do to properly pass in the proper filename?

    Thanks!
    Andrew.

  2. #2
      Moderator
    Good Guru
    Schotty
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,758
    while read `ls *` ; do 7za -y e $i; done
    find . -name ‘*.jpg’ | while read i; do ls -l "$i";
    find . -name ‘*.jpg’ -print0 | xargs -0 -l1 ls -l
    for i in *; do 7za -y e "${i}"; done


    Those are all solutions that I got in IRC. Figured I would pass them on. Of course a few were generic (like the middle two). Those are functionally identical.

+ Reply to Thread

Similar Threads

  1. SSH and bash script
    By vwgtiturbo in forum Programming
    Replies: 7
    Last Post: 12-25-2008, 05:40 AM
  2. Problem whit Script BASH!!!
    By Pitoniso in forum Windows – General Topics
    Replies: 2
    Last Post: 04-04-2007, 01:13 PM
  3. Bash script
    By linuxuser in forum Programming
    Replies: 1
    Last Post: 09-01-2005, 04:21 PM
  4. Bash Script question….
    By gfunkmonk in forum Programming
    Replies: 6
    Last Post: 08-26-2002, 10:47 PM
  5. Help with bash script
    By tolstoy in forum Programming
    Replies: 5
    Last Post: 05-21-2002, 12:17 PM

Bookmarks

Bookmarks

Posting Permissions

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