Find the answer to your Linux question:
Results 1 to 5 of 5
"Write a script to see if Lets_Count is a file. The display should state that it is or is not a file." I need help with this one, I am ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    5

    help with a conditional script

    "Write a script to see if Lets_Count is a file. The display should state that it is or is not a file."

    I need help with this one, I am so lost its not funny X_X

  2. #2
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Explain better and start with a few ideas, we'll help you throughout, if it's not homework (see forum rules)
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  3. #3
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Looks like homework to me and that's against the rules
    Linux User #453176

  4. #4
    Just Joined!
    Join Date
    Feb 2010
    Posts
    5

    ?_?

    #!/bin/sh
    # meow

    stat -c%F /home/barkeep/Lets_Count
    if [ "$stat -c%F /home/barkeep/Lets_Count" = "regular file" ]; then echo "is a file"
    else echo "is not a file"
    fi




    the outcome of the script.


    root@barkeep-desktop:/home/barkeep# . script6
    regular file
    is not a file

    and no ... this isn't home work.

  5. #5
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Code:
    test -f
    is smarter

    And why do you source your script ?

    Code:
    . script6
    Make it executable and run it

    Code:
    chmod +x script6
    script6
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

Posting Permissions

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