Shell scripts questions

Discussion in 'General Linux' started by OlgaD, Jul 2, 2014.

  1. OlgaD

    OlgaD New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi Professionals,
    I have some shell scripts problem here,could you please check my shell scripts whichhas been attached.

    I will be appreciated if you can help to reply me about this questions:
    question A:why all variables followed by the backslash,it will be explained by Linux literally ;
    question B:what is that mean" rm {} ",which has been stressed;

    Attached Files:

  2. MikeyD

    MikeyD Active Member

    Messages:
    232
    Likes Received:
    111
    Trophy Points:
    43
    A.) I'm really not sure :) At first, it looks like a here script: http://linuxcommand.org/lc3_wss0030.php based on the 'EOF' at the end, but there is no previous command where the script would be sent to. Although the backslashes would make more sense if it was. The backslash will make the shell interpret the next character literally (looks like you already know this...) as far as why they are doing this I'm not sure unless they are sending the commands to another program rather than directly running it at the shell.

    B.) rm {} is an argument to '-exec' in the find command. That line is saying, for any matches 'find' finds, it will execute 'rm' on that file (remove the file). Very helpful flag when trying to do something to multiple files:

    For example:
    Code:
    find . -name "L*" -exec file {} \;
    will find any files beginning with an uppercase "L" in the current dir and execute the 'file' command on each.
  3. OlgaD

    OlgaD New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    thanks very much

Share This Page