Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I am trying to get the length of a file into a variable. In the script I am using: export FLEN= `wc -m ${SOURCE_FILE} | cut -c1-2 ` echo ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    2

    exporting the result of a command in text


    Hi,
    I am trying to get the length of a file into a variable.

    In the script I am using:
    export FLEN= `wc -m ${SOURCE_FILE} | cut -c1-2 `
    echo ${FLEN}

    the result is:
    export: `59': not a valid identifier

    I want FLEN to = 59 in this case. How do I get redi of ` and ' in the above?

    Regards

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    try removing the space directly after the = sign, e.g.:
    Code:
    export FLEN=`wc -m $SOURCE_FILE | cut -c1-2 `

  3. #3
    Just Joined!
    Join Date
    Sep 2011
    Posts
    2
    Thanks atreyu - that worked

  4. $spacer_open
    $spacer_close

Posting Permissions

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