Skip to main content

All Questions

-1 votes
2 answers
1k views

Changing permission on multiple files within bash

I am trying to write a script to change the permissions of a number of other scripts, in multiple locations, to be executable. I've searched all over and can't seem to get the syntax correct. It is ...
pretz's user avatar
  • 161
1 vote
1 answer
2k views

korn shell - if a variable exists in an array stop processing without exiting

How would one evaluate priority of items in an array such that you only process the highest priority item that exists? Let me try to explain, if I had an array set -A array low medium none high this ...
Lonny Selinger's user avatar
5 votes
4 answers
16k views

Using case and arrays together in bash

Is it possible to check if a variable is contained inside an array using case? I would like to do something like ARR=( opt1 opt2 opt3 ); case $1 in $ARR) echo "Option is contained in the ...
red_trumpet's user avatar
-1 votes
3 answers
1k views

Working with dates

I have a task to do for which i am able to think of logic but unable to implement in Unix. I have a directory in which its sub-directories are having there naming pattern as 'mmddyy'. So my task here ...
Somesh Pursnani's user avatar
1 vote
0 answers
207 views

Access to bash arrays in gnuplot [duplicate]

In a bash script I have several arrays which I need to access in a gnuplot code: #!/bin/bash ... # fill array a[*] and b[*] ... gnuplot <<EOF do for [j=0:10] { # access ${a[j]} and ${b[j]} } ...
thyme's user avatar
  • 111
1 vote
1 answer
6k views

Compare two Arrays in KSH and output the difference

I am not extremely familiar with KSH (Actually just started using it) and I am having problems with trying to create a script that will essentially compare two arrays that have been stored and then ...
Christopher Stanley's user avatar
8 votes
3 answers
5k views

${#array} vs ${#array[@]}

As far as I can tell both ${#array[@]} and ${#array} evaluate to the number of elements in $array. Is there any reason for preferring the longer form (${#array[@]})?
kjo's user avatar
  • 16.2k