Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Folder with a space isn't recognized in a script


    Hey

    I'd get the error "target `thinking' is not a directory"

    for running this script

    Code:
    find -iname "*.pdf" | while read -r filename; do
    	if  pdfgrep -q "[[:digit:]]\.[[:blank:]]Critical thinking\." "$filename" ; then
    		mv "$filename" /home/arled/LCSH/Critical thinking
    fi
    done
    Why does the script behave that way and is there a way around it?

    Hi btw :)

  2. #2
    hi

    Code:
    mv "$filename" "/home/arled/LCSH/Critical thinking"
    or
    Code:
    mv "$filename" /home/arled/LCSH/Critical\ thinking

  3. #3
    Ohh ok I see

    Must be that the space is a metacharacter to shell and need to be escaped

  4. $spacer_open
    $spacer_close
  5. #4
    nicephotog, try to read shell's man page

    arled, indeed
    Quote Originally Posted by man bash
    metacharacter
    A character that, when unquoted, separates words. One of the following:
    | & ; ( ) < > space tab

Posting Permissions

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