Visit Our UNIX and Linux User Community


Set +A usage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Set +A usage
# 1  
Old 08-06-2009
Question Set +A usage

Hi Team,

Could you please explain me the usage of set +A command in setting values to an array ?

Also, what does the below command do ?

set +A filesSent ${filesSent[*]},${file}${FLAGEXT}

Thanks in advance.

Regards,
Mohan
# 2  
Old 08-06-2009
set -A or set +A works only in ksh, not in bash.
Code:
set -A arrayname list of values

Add echo before cmdline = see the result = howto shell expand commandline = after
that has done command.

You can make the list so many ways
- using some variable like $*
- cmd like $(who)
- give valuelist val1 val2 val3 "val4 is longer" val5


Code:
# number of elements in array
${#array[*]}

# all elements
${array[*]}

1st element index is 0
Code:
echo "1st:${array[0]}"
#
last=${#array[*]}
((last -= 1 ))
echo "last:${array[$last]}"

And last, shift array - remove 1st element
Code:
set -A array "${array[@]:1}"


Last edited by kshji; 08-06-2009 at 05:59 AM..
# 3  
Old 08-06-2009
KshJi, I just need only clarification.. What is the differeence between +A and -A ?
# 4  
Old 08-06-2009
Man says something but I have seen any differences. If arg list is empty, in both case array include still values. Maybe the reason is +/- which is normal for set options. Added only support for both, even result is same.

---------- Post updated at 11:09 AM ---------- Previous update was at 11:06 AM ----------

It is easy to hope:
set -A remove from the array
set +A add to the array
but no.

Previous Thread | Next Thread
Test Your Knowledge in Computers #122
Difficulty: Easy
Linux has been certified as UNIX (2019).
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies

2. UNIX for Dummies Questions & Answers

How to set server's ip address, router, network mask and set if it is an internal or external ip?

Hello, I need to write a program which sets server's ip address, router, network mask. Program also should set if it is an internal or external ip. Maybe someone can help me ? Any information from u is very useful :b: I stopped at .. :( #!/bin/sh A=`hostname -i` echo "server ip address is $A"... (4 Replies)
Discussion started by: zagaruika
4 Replies

3. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

4. Shell Programming and Scripting

Confused with the usage of one variable usage

Hi All I am not able to understand the usage of d# in the below variable declaration. FILE_LOC contains the directory path And also help me to know about what will be saved in the variable j. Thanks!!! j=${d#${FILE_LOC}/} (2 Replies)
Discussion started by: mohanm
2 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

6. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

7. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

8. UNIX for Dummies Questions & Answers

Usage of set in shell scripting

I am not able to understand the mentioned usage of set. $A set $l Please reply ASAP. Need to fix sth in my code. Thanks in advance. (0 Replies)
Discussion started by: trichyselva
0 Replies

9. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

10. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

Featured Tech Videos