Search Results

Search: Posts Made By: samsan
3,041
Posted By ongoto
Nothing major. It looks like part of your code...
Nothing major.
It looks like part of your code (in red) is missing...read iname
[ $iname ] || output;
if [ $iname -gt $SIZE ] || [ $iname -lt 1 ]; then
echo "Choice is out of range"
...
3,041
Posted By ongoto
You have to be careful not to enter a number that...
You have to be careful not to enter a number that is out of range. (zero or greater than the size of the list)

I made a few changes to catch that error and another bug I discovered...
function...
3,041
Posted By ongoto
An attempt to stay close to your original...
An attempt to stay close to your original script...
#!/bin/sh

declare -A AGES # associative name/ages array
NAMES=($(cat names.data | sort -u)) # unique names array...
3,041
Posted By sea
Here is something to get started, to chew on :p ...
Here is something to get started, to chew on :p

#!/bin/bash
#
#
# Variables
#
declare -A AGE # Create an associative array
NAMES="Kim Lee Jack Sam Nick Smith" # List with names
#...
3,041
Posted By RudiC
Might be an option if the OP's intentions were...
Might be an option if the OP's intentions were clear...
3,041
Posted By DGPickett
The use of numbers suggests you want to use a...
The use of numbers suggests you want to use a simple vector array, but why not skip the numbers and use just names and an associative array?
3,041
Posted By RudiC
I don't think above code is working fine. Having...
I don't think above code is working fine. Having corrected several logical and syntactical errors, I'm still not sure I understand what you are doing - you have a list of six name constants, and six...
1,048
Posted By RudiC
That's because the second time you (recursively)...
That's because the second time you (recursively) call function one, the else branch of if [ "$name" == "Sam" ]; will be taken.

BTW, you have a 16 bit char (0x 3000000, UTF8: 0xE3 0x80 0x80) in...
1,048
Posted By pravin27
#!/bin/sh function one () { echo...
#!/bin/sh

function one ()
{
echo "Who is here"
read name
echo "Who old are you $name"
read age

[[ "$name" == "Sam" ]] && Sam=$age
[[ "$name" == "Jack"...
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy