Find the answer to your Linux question:
Results 1 to 3 of 3
Hi! When I try this: Code: HTTPD=`locate httpd.conf` DOCUMENT_ROOT=`more $HTTPD | grep DocumentRoot | grep -v '^#' | awk '{print $2}'` cd $DOCUMENT_ROOT I see: -bash: cd: "/var/www/html": No such ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48

    Problem to enter into a directory from value

    Hi! When I try this:

    Code:
    HTTPD=`locate httpd.conf`
    DOCUMENT_ROOT=`more $HTTPD | grep DocumentRoot | grep -v '^#' | awk '{print $2}'`
    cd $DOCUMENT_ROOT
    I see:

    -bash: cd: "/var/www/html": No such file or directory

    I check my outputs and are:

    Code:
    echo $HTTPD
    /etc/httpd/conf/httpd.conf
    
    echo $DOCUMENT_ROOT
    "/var/www/html"
    What's exactly happend? Bash can't enter into a directory from value?
    thanks!

  2. #2
    Linux Newbie
    Join Date
    Sep 2004
    Location
    UK
    Posts
    160
    Try

    Code:
    DOCUMENT_ROOT=`more $HTTPD | grep DocumentRoot | grep -v '^#' | awk '{print $2}' | tr '"' ' '`
    I think it's the double quote marks (")
    In a world without walls and fences, who needs Windows and Gates?

  3. #3
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48
    very thanks!

Posting Permissions

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