I'm not sure what you're trying to do with your code, you're way overthinking it. All you need is text and a basic loop.
Version which is just text:
People jump straight into bash arrays convinced that everything needs to be an array when much of the time it's not really need at all.
I currently run a script over a vpnc tunnel to back-up my data to a remote server. However for a number of reasons the tunnel often collapses. If I manually restore the tunnel then the whole thing can continue, but I want to add into my script a section whereby while the transfer is taking place,... (8 Replies)
Hi all,
I am working on a backup based script, in which it enters to a directory and check the sub-directories and copy the names into an array.
cd $CPFs
k=0
for i in *
do
if
then
ARRs="$i"
k=$(($k+1))
#echo "$i"
... (19 Replies)
I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing
set
you can also use them "on the command line when running a script..." and it lists this in a small table:
set -o option Command Line... (5 Replies)
Hi,
I am writing a script to split a log file - the log could contain multiple days worth of logs. The second line of the log contains the string "Version ". In my test log which comprises of two days worth of logs, this string appears twice - once each day.
Essentially I would like to split... (7 Replies)
I am trying to look through one of my directories to remove certain files. I am pretty new to Unix and bash so I just need a little help in starting this. I know I would have to write two loops one to iterate the directories and one to iterate the files. How would I write the loops? (3 Replies)
Hi,
I am trying to do something similar to the for loop example from KSH For Loop Array: Iterate Through Array Values
$: cat y.ksh
#!/bin/ksh
# set array called nameservers
set -A nameservers 192.168.1.1 192.168.1.5 202.54.1.5
# print all name servers
for i in ${nameservers}
do
... (3 Replies)
I am trying to write a Bash Script using a couple of arrays. I need to perform a countdown of sorts on an array done once daily, but each day would start with the numbers from the previous day. This is what I'm starting with :
#!/bin/bash
days=(9 8 7 6 5)
for (( i = 0 ; i < ${#days} ; i++... (4 Replies)
Hello,
i have a script that should compare between ${ARRAY}
that contains all fstab record like this :
>>echo ${ARRAY}
/ /boot
between all mountpoints in my df that is stord in ${ARRAY2}
>>echo ${ARRAY2}
/ /boot /dev/shm /var/spool/asterisk/monitor
now i have this loop:
for i in... (6 Replies)
I am running plsql using printf on a shell, but i am getting some strange error, can someone point what exactly am i missing,
$ echo $SHELL
/bin/bash
$ printf "
> SET serveroutput ON trimspool on feed off echo off
> declare
> p_val number;
> d_val varchar2(10);
> begin
> SELECT... (1 Reply)
Discussion started by: kamauv234
1 Replies
LEARN ABOUT DEBIAN
upscli_list_start
UPSCLI_LIST_START(3) NUT Manual UPSCLI_LIST_START(3)NAME
upscli_list_start - begin multi-item retrieval from a UPS
SYNOPSIS
#include <upsclient.h>
int upscli_list_start(UPSCONN_t *ups, int numq, const char **query)
DESCRIPTION
The upscli_list_start() function takes the pointer ups to a UPSCONN_t state structure, and the pointer query to an array of numq query
elements. It builds a properly-formatted request from those elements and transmits it to upsd(8).
Upon success, the caller must call upscli_list_next(3) to retrieve the elements of the list. Failure to retrieve the list will most likely
result in the client getting out of sync with the server due to buffered data.
USES
This function implements the "LIST" command in the protocol. As a result, you can use it to request many different things from the server.
Some examples are:
o LIST UPS
o LIST VAR <ups>
o LIST RW <ups>
o LIST CMD <ups>
o LIST ENUM <ups> <var>
o LIST RANGE <ups> <var>
QUERY FORMATTING
To see the list of variables on a UPS called su700, the protocol command would be LIST VAR su700. To start that list with this function,
you would populate query and numq as follows:
int numq;
const char *query[2];
query[0] = "VAR";
query[1] = "su700";
numq = 2;
All escaping of special characters and quoting of elements with spaces are handled for you inside this function.
ERROR CHECKING
This function checks the response from upsd(8) against your query. If it is not starting a list, or is starting the wrong type of list, it
will return an error code.
When this happens, upscli_upserror(3) will return UPSCLI_ERR_PROTOCOL.
RETURN VALUE
The upscli_list_start() function returns 0 on success, or -1 if an error occurs.
SEE ALSO upscli_fd(3), upscli_get(3), upscli_readline(3), upscli_sendline(3), upscli_ssl(3), upscli_strerror(3), upscli_upserror(3)Network UPS Tools 05/31/2012 UPSCLI_LIST_START(3)