10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi All,
I am having command to run which will take argument as input file. Right now we are creating the input file by cat and executing the command
ftptransfer -i input file
cat >input file
file1
file2
cntrl +d
Is there a way I can do that in a single command like
... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
2. Shell Programming and Scripting
Dear community,
how can I create an array from file taking only the 4th field?
out.txt file is something like this:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20So the final array should be:
4 8 12 16 20With this command I created an array with all the fields, but I need only the 4th... (13 Replies)
Discussion started by: Lord Spectre
13 Replies
3. UNIX for Dummies Questions & Answers
I am having trouble creating an array, I've tried everything google gives me but it won't work, and it seems as though it should. Using Ubunto 12.04 and bash.
#!/bin/bash
ARRAY=one two three
echo ${ARRAY}When I do this I receive the error
: two: not found
and
: Bad substitution
When I... (3 Replies)
Discussion started by: jrymer
3 Replies
4. UNIX for Advanced & Expert Users
Here is the scenario:
At work I have been ask to create a custom ISO using UBUNTU as the chosen distro, install our prerequisted packages and present the customer with a choice of options of enabling and disabling services and just in general custom choices that I want to present to the user... (2 Replies)
Discussion started by: metallica1973
2 Replies
5. Shell Programming and Scripting
hi
I've 2 bash script, in the first i define an array and I'd like to pass it as argument to the second script.
For example:
first_bash:
k=(1 2 3 4)
.......
#in the end i call the 2 script
./second_bash $k
then in the second_bash:
.....
echo "${1}" #this not work
but i'm... (7 Replies)
Discussion started by: Dedalus
7 Replies
6. Programming
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
Discussion started by: kmehta
4 Replies
7. Shell Programming and Scripting
i want to create an array
the array elements are populated depending upon the number of entries present in a data file
The data file is created dynamically
how to achieve the same
thanks (1 Reply)
Discussion started by: trichyselva
1 Replies
8. Shell Programming and Scripting
I am looking to populate an (associated) array with a command line argument.
The command line would look something like this:
alert -action test -priority '10' -module test_module . . .
The associated array would look like this after the data is read in
flag=(action=test
priority=10... (1 Reply)
Discussion started by: jperret
1 Replies
9. UNIX for Dummies Questions & Answers
hello,
can any help me how to can pass array as command line argument in korn shell.
also how to read a array from command line.
thanks
spandu (2 Replies)
Discussion started by: spandu
2 Replies
10. Shell Programming and Scripting
hi, I was wondering if there was a good way to create an array within a function, where the name is based on a passed argument? I tried this:
_____________________________
func(){
#take in 1st arg as the arrayname
arrayName=$1
let i=0
while read line
do
arrayName=${line}
let i+=1... (5 Replies)
Discussion started by: nix21
5 Replies