Sponsored Content
Full Discussion: ksh question, loops
Top Forums Shell Programming and Scripting ksh question, loops Post 75728 by vgersh99 on Tuesday 21st of June 2005 04:13:22 PM
Old 06-21-2005
assuming /etc/host file format:
Code:
#!/bin/ksh
while read ip host junk
do
   lpadmin -p "${host}" -v /dev/null -m netstandard -o dest="${ip}"
done < myPrinterFile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about KSH line.

Wondering what this line meant, especially the 2>&1 and ${RUN_DIR} parts: ${RUN_DIR}/<filename> 2>&1 Where <filename> is the location and name of a file. (1 Reply)
Discussion started by: CapsuleCorpJX
1 Replies

2. UNIX for Dummies Questions & Answers

ksh question

How can I know if my system has ksh feature? #!/usr/bin/ksh Which command we allow me to see? Please advise! (1 Reply)
Discussion started by: bobo
1 Replies

3. Shell Programming and Scripting

ksh if block question

Hi, I am looking at a script, and it contains lines like: if ] ... This is getting me confused. Why do we need $ before (echo $* | egrep -c 'DG')? Why can't we simply have: if ] ... i.e. no $ here before the ()... Thanks. J (3 Replies)
Discussion started by: JamesByars
3 Replies

4. UNIX for Dummies Questions & Answers

Passing KSH variable to AWK with two loops

Hi, I need some help to figure out why an outer for loop KSH variable does not decode in AWK but inner for loop does. Below is my code, If I hard code variable 'SUBSEQ' in AWK it works but if I try to pass the SUBSEQ from KSH, it does not and when I pass the variable 'NAM' from KSH it works: I... (1 Reply)
Discussion started by: chowdhut
1 Replies

5. Shell Programming and Scripting

Nested while loops (ksh scripting)

You can use one while inside another? I made the following script (without really knowing if I can use two while) to get 3 numbers different from each other at random: num1=$(( $RANDOM % 10 )) num2=$num1 while do num2=$(( $RANDOM % 10 )) done num3=$num1 while do while do... (1 Reply)
Discussion started by: ale.dle
1 Replies

6. UNIX for Dummies Questions & Answers

Bourne-sh (not bash) question about nested loops and sed

Here's the input: alpha, numeric or alphanumeric string ("line 1 string") numeric string ("line 2 string") numeric string ("line 3 string") numeric string ("line 4 string") ... where - each numeric string is in a pattern that can be matched with RE but - there can be any number of... (2 Replies)
Discussion started by: uiop44
2 Replies

7. Shell Programming and Scripting

KSH nested loops?

KSH isn't my strong suit but it's what my company has to offer. I've got a script with two nested loops, a FOR and UNTIL, and that works fine. When I add a CASE into the mix I end up getting "Unexpected 'done' at line xx" errors. Any suggestions on this? for divi in at ce ci cm co de di fl... (9 Replies)
Discussion started by: mrice
9 Replies

8. Homework & Coursework Questions

Loops question

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: When the code is run only the first loop is utilized and it skips the following when it should move on after the... (2 Replies)
Discussion started by: TwistedKitty
2 Replies

9. Shell Programming and Scripting

Two for loops in ksh script only one not executing

Hello, I have two "for loops" in my script and the second one is not executing the way i want. Script: #!/bin/ksh IFS=' ' printf "Enter Account name: " read A B C D E F G H I J K L M N O for i in ${A} ${B} ${C} ${D} ${E} ${F} ${G} ${H} ${I} ${J} ${K} ${L} ${M} ${N} ${O};... (3 Replies)
Discussion started by: seekryts15
3 Replies

10. Shell Programming and Scripting

ksh - Need Help Reducing Nested Loops

Hello, I pulled out some old code from an unfinished project the other day and wanted to stream line it better. I know anything beyond a double loop is usually bad practice, and I came up with some logic for later that would no longer require the first loop in the following code that works: ... (5 Replies)
Discussion started by: Azrael
5 Replies
libssh2_knownhost_add(3)					  libssh2 manual					  libssh2_knownhost_add(3)

NAME
libssh2_knownhost_add - add a known host SYNOPSIS
#include <libssh2.h> int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, char *host, char *salt, char *key, size_t keylen, int typemask, struct libssh2_knownhost **store); DESCRIPTION
We discourage use of this function as of libssh2 1.2.5. Instead we strongly urge users to use libssh2_knownhost_addc(3) instead, which as a more complete API. libssh2_knownhost_add(3) is subject for removal in a future release. Adds a known host to the collection of known hosts identified by the 'hosts' handle. host is a pointer the host name in plain text or hashed. If hashed, it must be provided base64 encoded. The host name can be the IP numeri- cal address of the host or the full name. saltP is a pointer to the salt used for the host hashing, if the host is provided hashed. If the host is provided in plain text, salt has no meaning. The salt has to be provided base64 encoded with a trailing zero byte. key is a pointer to the key for the given host. keylen is the total size in bytes of the key pointed to by the key argument typemask is a bitmask that specifies format and info about the data passed to this function. Specificly, it details what format the host name is, what format the key is and what key type it is. The host name is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or LIBSSH2_KNOWN- HOST_TYPE_CUSTOM. The key is encoded using one of the following encodings: LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64. The key is using one of these algorithms: LIBSSH2_KNOWNHOST_KEY_RSA1, LIBSSH2_KNOWNHOST_KEY_SSHRSA or LIBSSH2_KNOWNHOST_KEY_SSHDSS. store should point to a pointer that gets filled in to point to the known host data after the addition. NULL can be passed if you don't care about this pointer. RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes and 0 indicates success. AVAILABILITY
Added in libssh2 1.2, deprecated since libssh2 1.2.5. Use libssh2_knownhost_addc(3) instead! SEE ALSO
libssh2_knownhost_init(3) libssh2_knownhost_free(3) libssh2_knownhost_check(3) libssh2_knownhost_addc(3) libssh2 1.2 28 May 2009 libssh2_knownhost_add(3)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy