Sponsored Content
Top Forums Shell Programming and Scripting Array not printing values if used in a loop Post 303017196 by arcoleman10 on Thursday 10th of May 2018 01:56:38 PM
Old 05-10-2018
Quote:
Originally Posted by vgersh99
couple of things:
  1. #!/bash/bin should be #!/bin/bash
  2. ./morse "a b c" should be ./morse "A B C" as you have your array indexed by the upper-cased letters. You may upper-case your input string prior to processing tho: typeset -u str=$1.
On the first part, actually I have that correct in my script haha just when I copy pasted it over I forgot it and typed it back in just incorrectly... ooops!

And secondly, thank you! Wow I feel really dumb for that... Guess you just always miss the smallest things...
 

10 More Discussions You Might Find Interesting

1. Programming

printing all array values using dbx 7.2.1

how do we print the entire contents of arrays in dbx ? Ive tried using print x to print values 1 to 5 of the array x, however dbx complains and doesnt allow this help is much appreciated (1 Reply)
Discussion started by: JamesGoh
1 Replies

2. Shell Programming and Scripting

How to use array values after the loop.

- I m retreving values from database and wish to use those values later in my shell script. I m placing these values in an array da_data but outside loop array is empty.Problem is its treating array as local inside loop hence array is empty outside loop. Plz go through the script and suggest how... (1 Reply)
Discussion started by: Devesh5683
1 Replies

3. Shell Programming and Scripting

Array Printing Inline

Dear friends , The output file of below script Pls#!/bin/sh awk '{ bo = substr($0,13,3) slm = substr($0,150,8) slo = substr($0,175,7) inc = substr($0,97,10)/100 busi = substr($0,83,10) mth = substr($0,39,2) yer = substr($0,35,4) ... (2 Replies)
Discussion started by: vakharia Mahesh
2 Replies

4. Shell Programming and Scripting

Assigning values to an array via for/while loop

I need to do something like this: for i in 1 2 3 4 5; do arr=$(awk 'NR="$i" { print $2 }' file_with_5_records) done That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop. Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies

5. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

6. UNIX for Dummies Questions & Answers

printing array elements

Is there a way to print multiple array elements without iterating through the array using bash? Can you do something like... echo ${array}and get all those separate elements from the array? (2 Replies)
Discussion started by: jrymer
2 Replies

7. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

8. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

9. Shell Programming and Scripting

How to swap the values in array using for loop?

array=( 8 5 6 2 3 4 7 1 9 0 ) for i in "${array}" do echo $i done # i need the output like this by swapping of array values 0 9 1 7 4 3 2 6 5 8 (7 Replies)
Discussion started by: Meeran Rizvi
7 Replies

10. Shell Programming and Scripting

Convert values in an array using a loop

I have a headerless array of 1000 columns x 100000 rows. The array only contains 4 values; 0/0, 0/1, 1/1, ./. Here I am showing the 1st 3 rows and columns of the input array 0/0 0/0 1/1 0/1 0/1 0/1 0/0 ./. 0/0 0/0 0/0 0/0 I would like to convert the values in... (9 Replies)
Discussion started by: Geneanalyst
9 Replies
XtSetKeyTranslator()													      XtSetKeyTranslator()

Name
  XtSetKeyTranslator - register a key translator.

Synopsis
  void XtSetKeyTranslator(display, proc)
	 Display *display;
	 XtKeyProc proc;

Inputs
  display   Specifies the display from which to translate the events.

  proc	    Specifies the procedure that is to perform key translations.

Description
  XtSetKeyTranslator()	registers  the	specified  procedure  as  the current key translator.  The default translator is XtTranslateKey(), an
  XtKeyProc that uses the Shift, Lock, and group modifiers with the interpretations defined by the X11 protocol.   XtTranslateKey()  is  pro-
  vided  so  that  new	translators can call it to get default keycode-to-keysym translations and so that the default translator can be rein-
  stalled.

  See XtKeyProc(2) for an explanation of the responsibilities of a key translator procedure.

Usage
  The key translator procedure is called by the Translation Manager to convert incoming keycodes and modifier bits to keysyms.	The only rea-
  son you would have to write and install your own key translator procedure is if you were working with non-standard keysyms.

  The only way to remove a translator is to register a new one.  For example, the default key translator (XtTranslateKey()) can be explicitly
  reinstalled.

See Also
  XtConvertCase(1), XtGetKeysymTable(1), XtKeysymToKeycodeList(1), XtRegisterCaseConverter(1), XtTranslateKeycode(1), XtTranslateKey(1),
  XtKeyProc(2).

Xt - Keyboard Handling													      XtSetKeyTranslator()
All times are GMT -4. The time now is 10:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy