Results 1 to 7 of 7

Thread: simple shell script

  1. #1
    TrollSoft NNTP User

    Default simple shell script

    #!/bin/bash
    echo hallo world


    this very simple shell-script will not work. chmod 777 was set. logging in as superuser changed nothing. I am using openSuse-11 beta. Within a quickly installed Ubuntu-Linux this script works.
    Has someone any idea?
    thanks
    Reinhold

  2. #2
    Join Date
    Jun 2008
    Location
    Boston MA area
    Posts
    61

    Default Re: simple shell script

    Can you tell us what you mean by "It would not work"? Are there any errors? Does it just not do anything? How are you invoking it? This works for me:

    Code:
    $ cat >etest
    #!/bin/bash
    echo Hello World
    ^D
    $ chmod 777 etest
    $ ./etest
    Hello World

  3. #3
    Join Date
    Jun 2008
    Location
    Friesland
    Posts
    207

    Default Re: simple shell script

    for me it works fine too:

    Code:
    echo echo hello world > test;chmod 750 test;./test
    stefan
    "The day Microsoft makes something that doesn't suck is the day they make a vacuum cleaner"
    OS: Fedora9, RHEL5, CENTOS5, Arch, OpenSuSe11
    Hardware: Dell Precision M65

  4. #4
    TrollSoft NNTP User

    Default Re: simple shell script

    thanks for the answers.

    I used a second file for the script and everything works fine. But now to the real problem:

    I compiled a shared library and a main with g++. Both were developed under Windows. Compilation was ok. But when starting the main, I got the error
    main: error while loading shared libraries .. no such file
    someone told me to use following script. The script now works, but the library error goes on.

    has someone any idea

    #!/bin/bash
    echo Hello World
    cp main main.bak
    cat main.bak | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > main
    ./main

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,721

    Default Re: simple shell script

    btw you do not need the cat:
    Code:
    #!/bin/bash
    echo Hello World
    cp main main.bak 
    sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" main.bak > main
    ./main
    I do not see what the added value of the echo is to the script.

    I suppose this script does anyhow do something because it consists of legal constructs. But as you do not tell what your intention is, I can not know what is wrong or right with it. As I see it it will change all occurencies of "export LD_ASSUME_KERNEL" into "#xport LD_ASSUME_KERNEL" in the file main. It also creates a file main.bak with the original contents of main.
    Now when this was that you think it should do, your script seems OK to me.

    Youir real problem seems to be with the program main. But not with this script.
    Henk van Velden

  6. #6
    TrollSoft NNTP User

    Default Re: simple shell script: everything ok

    hi,
    i found an apropriate tutorial.
    everything works now
    thanks

  7. #7
    ab@novell.com NNTP User

    Default Re: simple shell script

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Care to share?

    Good luck.





    TrollSoft wrote:
    | hi,
    | i found an apropriate tutorial.
    | everything works now
    | thanks
    |
    |
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFIY6t43s42bA80+9kRAqXzAJ9R/WdgNnvGw7OAzixFhKZM+O95QgCaAghN
    kVpYBm7Kl7FEeu5f5nFd314=
    =GWhB
    -----END PGP SIGNATURE-----

Posting Permissions

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