Sponsored Content
Full Discussion: problem in if condition
Top Forums Shell Programming and Scripting problem in if condition Post 302255588 by mail2sant on Thursday 6th of November 2008 07:01:11 PM
Old 11-06-2008
problem in if condition

hi,
actully i need the belp for the below.

host_list=" Host1 host2 host3 host4 "

n=`hostname`

i need to put the condition like the below

if n is among the host mention in the host_list if [ n in "$host_list" ]

then

#some stugg

else
# some other stuff

fi
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If condition problem

Hi Guys, I want to use if conition for my script. Before I used it tried it with some small test scripts. But it was not succeeded. My script and screen output as follows, Script: echo 'Do you think Yes or No (y/n) : ' read ans echo You input anser as $ans ans1=y if ( $ans == $ans1... (5 Replies)
Discussion started by: maheshsri
5 Replies

2. Shell Programming and Scripting

problem with if condition

hi, :) pls consider the following if statement if //g') ] then ........ else ....... when i execute the script i am getting the following error '(' unexpected I am not able to find the mistake. could anybody tell where i did mistake. cheers RRK (13 Replies)
Discussion started by: ravi raj kumar
13 Replies

3. Shell Programming and Scripting

problem in if then else condition

Hi , I am trying the following simple script . But it is always giving 1 output. Dont know why #!/bin/sh find . -name "a.log" if ; then echo "1" else echo "0" fi Kindly advice. it is giving 1 output even when the a.log file is not there (26 Replies)
Discussion started by: himvat
26 Replies

4. Shell Programming and Scripting

Problem in using AND OR condition together

a=rhino b=crocodil c=testsc if && "$c" = testsc ] then echo "Test #5 succeeds." else echo "Test #5 fails." fi i need to test or condition before check the output with AND condition. ur help is much appreciated... (11 Replies)
Discussion started by: gokulraj23
11 Replies

5. Shell Programming and Scripting

Problem in if condition

Hi all, I have task to delete two different files from all file system. one is core file & other is old file. i can delete core file but for old file i have to mv in different location. i wrote a script but it is not working. i have a two variables in this script first one is delcnt &... (6 Replies)
Discussion started by: dravi_laxmi
6 Replies

6. Shell Programming and Scripting

If condition problem

Hi, I need to use if condition for search a file pattern on a particular location. cd $file_Path if || then do this else do that fi Can someone help me with the if part, how i can put those conditions? make sure format should be *.file* and *.file file is a keyword which i... (5 Replies)
Discussion started by: amit.mathur08
5 Replies

7. Shell Programming and Scripting

Problem with IF condition .

Hi i am writing a script where i am running , 5 scripts together in 1 script . Now what i want is when these 5 scripts run completely , i should execute some other commands like i have compile the data etc. I have have 5 echo statements at the end of all those scripts . Like echo "1 is done" in... (1 Reply)
Discussion started by: honey26
1 Replies

8. Shell Programming and Scripting

If condition problem

Hi All, I am using below if condition to check whether null is passed as a parameter to the program if or ; then echo "ABC">>$FILE else echo "CDF">>$FILE fi However it is saying me null=null command not found . Please help me with this (9 Replies)
Discussion started by: Hypesslearner
9 Replies

9. Shell Programming and Scripting

Condition problem

Hi All, Seeking for your assistance on how to condition it correctly. cat file1.txt 290,1663,43,888,0,0.00,86.91,0.00,26.98,0.00 290,1663,52,0,0,0.00,0.00,0.00,0.00,0.00 290,1663,52,888,0,0.00,34.60,0.00,9.00,0.00 1st scenario: if the fourth column contains 888s and 0s it is by... (16 Replies)
Discussion started by: znesotomayor
16 Replies
Slurm API(3)						 Slurm host list support functions					      Slurm API(3)

NAME
slurm_hostlist_create, slurm_hostlist_shift, slurm_hostlist_destroy - Slurm host list support functions SYNTAX
#include <slurm/slurm.h> hostlist_t slurm_hostlist_create ( char *node_list ); char * slurm_hostlist_shift ( hostlist_t host_list ); void slurm_hostlist_destroy ( hostlist_t host_list ); ARGUMENTS
node_list A list of nodes as returned by the slurm_job_step_create functions. The returned value may include a simple range format to describe numeric ranges of values and/or multiple numeric values (e.g. "linux[1-3,6]" represents "linux1", "linux2", "linux3", and "linux6"). host_list A hostlist created by the slurm_hostlist_create function. DESCRIPTION
slurm_hostlist_create creates a database of node names from a range format describing node names. Use slurm_hostlist_destroy to release storage associated with the database when no longer required. slurm_hostlist_shift extracts the first entry from the host list database created by the slurm_hostlist_create function. slurm_hostlist_destroy releases storage associated with a database created by slurm_hostlist_create when no longer required. RETURN VALUE
slurm_hostlist_create returns the host list database or NULL if memory can not be allocated for the database. slurm_hostlist_shift returns a character string or NULL if no entries remain in the database. EXAMPLE
#include <stdio.h> #include <hostlist.h> #include <slurm.h> int main (int argc, char *argv[]) { hostlist_t my_hostlist; char *hostnames, *host; /* generate a list of hostnames, possibly using a */ /* slurm job step creation function */ my_hostlist = slurm_hostlist_create (hostnames); if (my_hostlist == NULL) { fprintf (stderr, "No memory "); exit (1); } while ( (host = slurm_hostlist_shift(my_hostlist)) ) printf ("host = %s ", host); slurm_hostlist_destroy (my_hostlist) ; exit (0); } NOTE
These functions are included in the libslurm library, which must be linked to your process for use (e.g. "cc -lslurm myprog.c"). COPYING
Copyright (C) 2002-2006 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE-OCEC-09-009. All rights reserved. This file is part of SLURM, a resource management program. For details, see <http://www.schedmd.com/slurmdocs/>. SLURM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. SLURM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. SEE ALSO
slurm_get_job_steps(3), slurm_load_jobs(3), slurm_load_partitions(3) Morris Jette September 2006 Slurm API(3)
All times are GMT -4. The time now is 05:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy