Linux.com

CCC

CCC

  • Linux.com Member
  • Posts: 12
  • Member Since: 14 May 09
  • Last Logged In: 25 Oct 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • CCC
    RE: question about permissions and sudo
    [b]atreyu wrote:[/b] [quote]Okay, so if you're writing a simple script, are you have trouble executing it? Make sure the script is executable: [code] chmod +x script.sh[/code][/quote] This will make the script executable for all users. (To make the script executable only for the owner of the file, use [code]chmod u+x script.sh[/code]) To find out whether or not the script is executable, you can use [code]ls -l script.h[/code], which should give you a line starting with a bunch of letters and dashes, something like: [code]-rwxrwxrwx[/code] Any of those letters may be replaced by dashes. If none of the x's are there, then your file will not be executable. The first x is whether or not the user that owns the file can execute it; the second x is whether a member of the group that owns the file can execute it; and the last x is whether other people can execute it. (The r's and w's indicate whether or not the owner, group, or others have read and write permissions). If the letter is there, so is the permission; if not, then the permission is absent (and you'll need to chmod it before you can run it).
    Link to this post 04 Jun 09

    atreyu wrote:

    Okay, so if you're writing a simple script, are you have trouble executing it? Make sure the script is executable:

    [code] chmod +x script.sh[/code]

    This will make the script executable for all users. (To make the script executable only for the owner of the file, use

    chmod u+x script.sh
    )

    To find out whether or not the script is executable, you can use

    ls -l script.h
    , which should give you a line starting with a bunch of letters and dashes, something like:

    -rwxrwxrwx

    Any of those letters may be replaced by dashes. If none of the x's are there, then your file will not be executable. The first x is whether or not the user that owns the file can execute it; the second x is whether a member of the group that owns the file can execute it; and the last x is whether other people can execute it. (The r's and w's indicate whether or not the owner, group, or others have read and write permissions). If the letter is there, so is the permission; if not, then the permission is absent (and you'll need to chmod it before you can run it).

  • CCC
    RE: Reading Users Guide, script don't run???
    [b]tw3ak wrote:[/b] [quote]#!/bin/sh echo "Hi there" echo "What is your name? Rob" read NM Rob echo "Hello $NM" The book is a bit dated and wondered if the read command syntax changed a bit for bash shell? I get the first two lines but don't get the hello rob part.[/quote] I just had a thought. After you get the first two lines, what do you do? You've told the script to print out those two lines and then wait for someone to type something in on the keyboard, and press enter. If you're not typing something in and hitting enter, then you're not going to get a "Hello Rob" (the computer has infinite patience, it will wait for years for that keyboard input if necessary...) In fact, you've asked it for [i]two[/i] pieces of input...
    Link to this post 04 Jun 09

    tw3ak wrote:

    #!/bin/sh
    echo "Hi there"
    echo "What is your name? Rob"
    read NM Rob
    echo "Hello $NM"


    The book is a bit dated and wondered if the read command syntax changed a bit for bash shell?
    I get the first two lines but don't get the hello rob part.

    I just had a thought. After you get the first two lines, what do you do?

    You've told the script to print out those two lines and then wait for someone to type something in on the keyboard, and press enter. If you're not typing something in and hitting enter, then you're not going to get a "Hello Rob" (the computer has infinite patience, it will wait for years for that keyboard input if necessary...)

    In fact, you've asked it for two pieces of input...

  • CCC
    RE: ping rtt
    The ping command will do that for you. Try typing [code]ping [/code] into a terminal and see (if you don't have a server to test on, then [code]ping localhost[/code] will do). You will see a series of lines, one per packet, ending in "time=xxx" - whatever that xxx is, that's the round trip time for that packet. When you end the ping (ctrl-c), it will even give you the minimum/average/maximum round trip times for the run (I think mdev is the calculated deviation...)
    Link to this post 04 Jun 09

    The ping command will do that for you. Try typing

    ping <server>
    into a terminal and see (if you don't have a server to test on, then
    ping localhost
    will do). You will see a series of lines, one per packet, ending in "time=xxx" - whatever that xxx is, that's the round trip time for that packet.

    When you end the ping (ctrl-c), it will even give you the minimum/average/maximum round trip times for the run (I think mdev is the calculated deviation...)

  • CCC
    RE: more man page trouble
    [b]woboyle wrote:[/b] [quote][b]CCC wrote:[/b] [quote]Now if you try [code]export PATH="$PATH:/opt/gnome/bin"[/code] and then [code]echo $PATH[/code] again, you'll see that the PATH environment variable now has ":/opt/gnome/bin" stuck on the end, but is otherwise unchanged. (The colon is there to separate directories).[/quote] DON'T do this:[code]export PATH="$PATH:/opt/gnome/bin"[/code] as environment variables can get confused depending upon the following character (a colon in this case). It is better to use[code]export PATH="${PATH}:/opt/gnome/bin"[/code] Using $PATH by itself is not recommended. Using ${PATH} is as there is no ambiguity - the terminating curly-brace is definitive.[/quote] My apologies. You are, of course, perfectly correct; the {}s are better practice.
    Link to this post 03 Jun 09

    woboyle wrote:

    [b]CCC wrote:[/b]
    [quote]Now if you try [code]export PATH="$PATH:/opt/gnome/bin"[/code] and then [code]echo $PATH[/code] again, you'll see that the PATH environment variable now has ":/opt/gnome/bin" stuck on the end, but is otherwise unchanged. (The colon is there to separate directories).

    DON'T do this:
    export PATH="$PATH:/opt/gnome/bin"
    as environment variables can get confused depending upon the following character (a colon in this case). It is better to use
    export PATH="${PATH}:/opt/gnome/bin"
    Using $PATH by itself is not recommended. Using ${PATH} is as there is no ambiguity - the terminating curly-brace is definitive.[/quote]

    My apologies. You are, of course, perfectly correct; the {}s are better practice.

  • CCC
    RE: Fault Injection / Mutation testing
    I'm not sure if this is what you need, but I do know that gdb can be used to send any signal to a program being debugged at any point during execution (though it may have to be at a breakpoint). If you want to test faults in input data, then that's surely a matter of setting up your test cases with faults...
    Link to this post 28 May 09

    I'm not sure if this is what you need, but I do know that gdb can be used to send any signal to a program being debugged at any point during execution (though it may have to be at a breakpoint).

    If you want to test faults in input data, then that's surely a matter of setting up your test cases with faults...

  • CCC
    RE: i need help about command copy file.
    To change directory, you would need the cd command (e.g. to change to a directory called "directory", type [code]cd directory[/code]). To move up one directory, type [code]cd ..[/code] (that's two dots). You might find a graphical file browser easier to use; try typing [code]konqueror[/code] at the command prompt to get one. (Then click on the little picture of a house in the toolbar to get to your home directory).
    Link to this post 28 May 09

    To change directory, you would need the cd command (e.g. to change to a directory called "directory", type

    cd directory
    ). To move up one directory, type
    cd ..
    (that's two dots).

    You might find a graphical file browser easier to use; try typing

    konqueror
    at the command prompt to get one. (Then click on the little picture of a house in the toolbar to get to your home directory).

  • CCC
    RE: md5 checksum
    md5sum What it does is generate a string of bizarre characters, technically known as an md5 checksum. These bizarre characters have the following useful properties: - It is virtually impossible to work out the original file from the characters - A small change in the file will result in a large change in the checksum - The same file will always produce the same bizarre string - The checksum is always the same (fairly short) length, regardless of the length of the file This means that if someone puts a file up on a website, they can fairly easily put up the checksum as well. And if you download the file, and then run md5sum , and your checksum is the same as the checksum on the website, then you can be very sure that there were no transmission errors and you've got the whole file. (Technically speaking, there is a tiny tiny (1 in 2^128, roughly) chance that you've got an erroneous or truncated file that produces the same checksum; but you've got several million times more chance of winning the lottery than that).
    Link to this post 27 May 09

    md5sum <file>

    What it does is generate a string of bizarre characters, technically known as an md5 checksum. These bizarre characters have the following useful properties:

    - It is virtually impossible to work out the original file from the characters
    - A small change in the file will result in a large change in the checksum
    - The same file will always produce the same bizarre string
    - The checksum is always the same (fairly short) length, regardless of the length of the file

    This means that if someone puts a file up on a website, they can fairly easily put up the checksum as well.

    And if you download the file, and then run md5sum <file>, and your checksum is the same as the checksum on the website, then you can be very sure that there were no transmission errors and you've got the whole file. (Technically speaking, there is a tiny tiny (1 in 2^128, roughly) chance that you've got an erroneous or truncated file that produces the same checksum; but you've got several million times more chance of winning the lottery than that).

  • CCC
    RE: more man page trouble
    I'd suggest that you do an [code]echo $PATH[/code]. That will show you what your PATH variable currently is; it'll be a whole lot of directories, separated by colons. When you type in a command without a path, for example "ls", it will search through those directories, one by one, for a program entitled ls and run it. Now if you try [code]export PATH="$PATH:/opt/gnome/bin"[/code] and then [code]echo $PATH[/code] again, you'll see that the PATH environment variable now has ":/opt/gnome/bin" stuck on the end, but is otherwise unchanged. (The colon is there to separate directories). Using an equals instead of a colon will probably (I'm not quite sure here) result in it trying to look in a directory with a name something like /bin=/opt/gnome/bin every time it tries to run a command; since /bin= (presumably) doesn't exist, this will cause a problem. Especially as it's no longer looking in /bin (which includes, for example, ls); which can cause problems. (Your PATH might not have /bin at the end; it is merely used in an illustrative sense). If you use [code]export PATH="/opt/gnome/bin"[/code], then your path will only consist of /opt/gnome/bin. Now try something simple, like ls... and then it's probably a good idea to close that terminal and open a new one.
    Link to this post 27 May 09

    I'd suggest that you do an

    echo $PATH
    . That will show you what your PATH variable currently is; it'll be a whole lot of directories, separated by colons. When you type in a command without a path, for example "ls", it will search through those directories, one by one, for a program entitled ls and run it.

    Now if you try

    export PATH="$PATH:/opt/gnome/bin"
    and then
    echo $PATH
    again, you'll see that the PATH environment variable now has ":/opt/gnome/bin" stuck on the end, but is otherwise unchanged. (The colon is there to separate directories).

    Using an equals instead of a colon will probably (I'm not quite sure here) result in it trying to look in a directory with a name something like /bin=/opt/gnome/bin every time it tries to run a command; since /bin= (presumably) doesn't exist, this will cause a problem. Especially as it's no longer looking in /bin (which includes, for example, ls); which can cause problems. (Your PATH might not have /bin at the end; it is merely used in an illustrative sense).

    If you use

    export PATH="/opt/gnome/bin"
    , then your path will only consist of /opt/gnome/bin. Now try something simple, like ls... and then it's probably a good idea to close that terminal and open a new one.

  • CCC
    RE: Installing Ubuntu Jaunty on second internal disc
    It should ask you partway through the installation which partition you'd like to install to, and whether you'd like to format any of them; at which point you simply select the partition you want Ubuntu on.
    Link to this post 21 May 09

    It should ask you partway through the installation which partition you'd like to install to, and whether you'd like to format any of them; at which point you simply select the partition you want Ubuntu on.

  • CCC
    RE: User Guide confusion
    "|", in this context, means "or" (not "pipe"). That is, [+|-] means "optional plus or minus". As an example, the "man grep" page includes [-e PATTERN | -f FILE] - which means I can use grep -e with a pattern, or grep -f with a file, but I can't use -e and -f at the same time. Nested brackets are allowed; for example, in the man gcc page (a bit of a long one to read through, and probably only of interest if you plan to be writing software in the very near future, but it's the first example I found), I see the following (among other options): [-Dmacro[=defn]...]; that means that I can use -Dmacro if I want, and [i]if[/i] I do so I have the option of adding a definition to the end of the command after an equals sign (but I can't do that without the -Dmacro).
    Link to this post 21 May 09

    "|", in this context, means "or" (not "pipe"). That is, [+|-] means "optional plus or minus".

    As an example, the "man grep" page includes [-e PATTERN | -f FILE] - which means I can use grep -e with a pattern, or grep -f with a file, but I can't use -e and -f at the same time.

    Nested brackets are allowed; for example, in the man gcc page (a bit of a long one to read through, and probably only of interest if you plan to be writing software in the very near future, but it's the first example I found), I see the following (among other options): [-Dmacro[=defn]...]; that means that I can use -Dmacro if I want, and if I do so I have the option of adding a definition to the end of the command after an equals sign (but I can't do that without the -Dmacro).

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board