10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm playing with ksh. I'm trying to do a simple task:
read file name from cli and call a function which calculated number of lines in file.
I'm getting coredump every time when I try to read that file.
Korn shell version
$ print ${.sh.version}
Version AJM 93u+ 2012-08-01
Main... (5 Replies)
Discussion started by: solaris_user
5 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column.
For example:
Sample file "file1.txt":
1 name1 a first
2 name2 b second
3 name3 c third
and have arrays such as:
line1 = ( "1" "name1" "a"... (3 Replies)
Discussion started by: ShiGua
3 Replies
3. Shell Programming and Scripting
Good grief so this should be easy. Passing an array as an argument to a function. Here is the sample code:
#/bin/bash
function foo {
local p1=${1}
local p2=(${2})
local p3=${3}
echo p1 is $p1
echo p2 is $p2
echo p3 is $p3
}
d1=data1
d2=data2
a=(bat bar baz) (2 Replies)
Discussion started by: brsett
2 Replies
4. Shell Programming and Scripting
I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them.
Example:
"015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command:
... (4 Replies)
Discussion started by: Shimmey
4 Replies
5. Programming
this is my code to try and prinnt out a deck of cards. the print function worked when used inside main without being a function but now i cant get it to work as a function probably since i dont know how to pass a struct array in c. I gave it a shot but i keep getting an assortment of errors. The... (0 Replies)
Discussion started by: bjhum33
0 Replies
6. Programming
Hi.
I have a problem with passing two dimensional array to a function.
First, let me show my code to explain what i am going to do:
I have function:void initialize_board(char board);which is supposed to modify content of passed array. I have read here: Question 6.18 how such arrays should be... (3 Replies)
Discussion started by: Shang
3 Replies
7. Shell Programming and Scripting
Let me know if there is a way to pass array to a funtion in ksh script.
function isPresent
{
typeset member
member=$1
dbList=$2
echo '$1:' $1
echo '$2' $dbList
The array will be at the second position....something like this
isPresent 12 <array>
if
then
echo... (3 Replies)
Discussion started by: prasperl
3 Replies
8. Shell Programming and Scripting
Hi,
I'm trying to write a function that reassigns an array to
another local array but the method used in reassigning
the array reformats the contents of the array which is
what I am trying to prevent.
The method used to load a file into an array works as
expected and the entire array is... (4 Replies)
Discussion started by: ASGR
4 Replies
9. Shell Programming and Scripting
Hi,
I'm trying to work on the script given below
#!/bin/ksh -x
pfile()
{
echo "$1"
}
touch smp19
echo "Hi" > smp19
result=$(pfile $smp19)
echo $result
As highlighted , when i pass $smp19 as parameter ,it does not display the output.However when i try giving "Hi" instead... (2 Replies)
Discussion started by: Sheema
2 Replies
10. Shell Programming and Scripting
Hi All,
I have some questions regarding array arguements passing for Perl Function.
If @array contains 2 items , arguements passing would be like Code_A.
But what if @array needs to add in more items, the rest of the code like $_ will have to be modified as well (highlighted in red), which is... (5 Replies)
Discussion started by: Raynon
5 Replies