User Profile

Collapse

Profile Sidebar

Collapse
bykwzpz
bykwzpz
Last Activity: Feb 17 '08, 06:11 PM
Joined: Jan 28 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • bykwzpz
    replied to Swap two int values
    in C
    Here is a way:

    <Code removed my MODERATOR - Please read our Posting Guidelines>
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Excellent! What was it?
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Hi Robbie,

    Try this script in a separate file. I called mine 'mytest'. When you have created this script, use chmod +x to make it executable. Then execute it using ./mytest from your command prompt.

    If you get the message "Error - NO VHOME", then the structure of the if statement is sound. The syntax error is somewhere else - perhaps in some of the statements within the if statement. If you don't get the...
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Fedora's sh should execute like UNIX/LINUX sh, so I don't think that is the cause. Are you sure that you have spaces between the braces? I'm going to use underscore instead of space below to illustrate where spaces are required:

    Code:
    #example showing underscores instead of spaces
    if_[_$VMHOME_=_''_]_;_then
    
    #example showing spaces
    if [ $VMHOME = '' ] ; then
    This shows...
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Look at the extra quote character just before the right brace. Also, what are the extra 'then' lines doing in the script on lines above and below the 'log "=== EXIT' line?...
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    You don't have the 'then' in your if statement. It comes right after the if line:
    Code:
    if [ <expession> ]
    then
    <statements>
    fi
    May also be written as:

    [CODE]
    if [ <expression> ] ; then
    <statements>
    fi
    [\CODE]

    Also, you will probably get some errors from your log statements. Unless you have written 'log' as a procedure...
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Okay, now I see the problem. The clue was that you normally operate in PHP. The if statement that you have is fine in PHP, but shell has a different structure. Try this:

    [CODE]
    if [ $VMHOME = "" ]
    then
    <what you want to do if VMHOME not set>
    fi
    [\CODE]

    Spaces around the braces ( [ ] ) are required. I tried this on my own system and it works reliably.
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to determine if value is set
    Hi,

    You might try -eq instead of just eq.

    Hope this helped....
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to Help on this loop
    You might consider this:

    [CODE]
    userlist=`who | cut -d " " -f1`
    for username in $userlist
    do
    <whatever you need to do with $username>
    done
    [\CODE]

    Let me know if this was helpful....
    See more | Go to post

    Leave a comment:


  • I agree - unless the executable fails. You might consider using the return code to determine the success or failure of the process. Most processes in UNIX return zero (0) as success and I will continue assuming yours does too.

    The shell script would look something like this:

    Code:
    your_c++_executable || {
         error_handling_procedure
         exit 1
         }
    
    procedure_to_get_ reports
    ...
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to append a value to an existing variable?
    Another way is to simply redefine the variable and include the original like this:

    test="monkey" #${test} = monkey
    test="${test} dog" #${test} now = "monkey dog"

    This would all be done in memory without using the file on disk and be faster....
    See more | Go to post

    Leave a comment:


  • bykwzpz
    replied to problem with executing procedure
    Hi,

    You might try revising your SQL code line to this:
    $SQLPLUS -S $sql_user_name/$sql_user_pwd@$ sql_service1>>$ LOG_FILE 2>&1 <<EOF

    In this line, you are instructing the system to send standard out and standard error to the same place as before, but the real source of your problem was the <<EOF had to be the last thing on the line. You're creating what is sometimes called a 'here document.'...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...