Sponsored Content
Top Forums Shell Programming and Scripting Need help with array substitution Post 303000286 by RudiC on Saturday 8th of July 2017 06:33:06 AM
Old 07-08-2017
Need to memorize that...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Array help (variable substitution).

I am using an array (clmlist01). I have 61 of these and have 4 or more references to each one in a block of code that I do not want to have to hardcode. With that being said, I am creating a varible and going through a for loop to create the actually name of each array. The arrays would end up... (3 Replies)
Discussion started by: dsimpg1
3 Replies

2. Programming

Creating an array to hold posix thread ids: Only dynamic array works

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

3. Shell Programming and Scripting

Tricky array substitution in functions

Hello, Please tell me if there is a better way to get the number of elements from an array that is passed to a function. This is what works on Solaris 8 (ksh) but it looks odd: loop_array() { array_name=$2 b1='\${\#' b2='}' nr_elements=`eval echo... (6 Replies)
Discussion started by: majormark
6 Replies

4. Shell Programming and Scripting

Difference between "Command substitution" and "Process substitution"

Hi, What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution? while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file But, while IFS='\n' read -r... (3 Replies)
Discussion started by: royalibrahim
3 Replies

5. Shell Programming and Scripting

Array reference - bad substitution

I've created a series of arrays named as follows: row1 row2 row3 . . . row10 Each has 4 elements. I'm trying to echo the array elements out in a for loop. Here's what I have: for ((i=1;i<=10;i++)) do for ((j=1;j<=4;j++)) do eval out=${row`echo $i`} echo -n $out (3 Replies)
Discussion started by: swankgd
3 Replies

6. Shell Programming and Scripting

Substitution in a file dont work with an Array in filename

Hi. I´ve a script that should substitude the 8th line in a file called xxx.num6. The "xxx" is set by an array filled with this command: j=0 for Par in *.sys ; do Par=`echo $Par | sed 's/\(.*\).sys/\1/'` ; Par2="$Par" ; echo "${Par2}" j=$((j + 1)); done Now i try... (0 Replies)
Discussion started by: Lock3
0 Replies

7. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

8. Shell Programming and Scripting

Bash 3.2 - Array / Regex - IF 3rd member in array ends in 5 digits then do somthing...

Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help. pesudo code if == ENDSINFIVEINTS ]]; then do... (4 Replies)
Discussion started by: briandanielz
4 Replies

9. Shell Programming and Scripting

Variable substitution in array printing

Hi folks, A really dumb question as I've wasted far too long trying to get this to work.... (on RH bash) I have an array: m0='<hello>' m0='<there>' m0='<fred>' v0='<goodbye>' v0='<again>' v0='<john>' in my code I calculate the value of the variable to output and if I echo it, I... (2 Replies)
Discussion started by: say170
2 Replies

10. Shell Programming and Scripting

Bash arrays: rebin/interpolate smaller array to large array

hello, i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N. for case 1, I want to stretch N to fit M arrayHuge H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
FDREAD(1)						    BSD General Commands Manual 						 FDREAD(1)

NAME
fdread -- read floppy disks SYNOPSIS
fdread [-qr] [-d device] [-f fillbyte] [-o file] fdread [-d device] -I numsects [-t trackno] DESCRIPTION
The fdread utility reads floppy disks. Effective read blocking based on the track size is performed, and floppy-specific error recovery of otherwise bad blocks can be enabled. The fdread utility will always read an entire floppy medium, and write its contents to the respective output file. Unlike other tools like dd(1), fdread automatically uses a read block size that is more efficient than reading single blocks (usually one track of data at a time), but falls back to reading single floppy sectors in case of an input/output error occurred, in order to obtain as much valid data as possible. While fdread is working, kernel error reporting for floppy errors is turned off, so the console and/or syslog are not flooded with kernel error messages. The fdread utility accepts the following options: -q Turn on quiet mode. By default, the medium parameters of the device are being written to standard error output, progress will be indicated by the approximate number of kilobytes read so far, and errors will be printed out in detail, including the information about the location of recovered data in the output. In quiet mode, none of these messages will be generated. -r Enable error recovery. By default, fdread stops after the first unrecovered read error, much like dd(1) does. In recovery mode, however, one of two recovery actions will be taken: o If the error was a CRC error in the data field, the kernel is told to ignore the error, and data are transferred to the output file anyway. Note that this will cause the erroneous data to be included in the output file! Still, this is the best recovery action that can be taken at all. o All other errors are really fatal (usually, the FDC did not find the sector ID fields), thus a dummy block with fill bytes will be included in the output file. Unless operating in quiet mode, the action taken and the location of the error in the output file will be displayed. -d device Specify the input floppy device, defaulting to /dev/fd0. The parameter device must be a valid floppy disk device. -f fillbyte Value of the fill byte used for dummy blocks in the output file in recovery mode. Defaults to '0xf0'. (Mnemonic: ``foo''.) The value can be specified using the usual C language notation of the number base. -o file Specify the output file to be file. By default, the data will be written to standard output. -I numsects Read numsects sector ID fields, and write out their contents to standard output. Each sector ID field contains recorded values for the cylinder number ('C'), the head number ('H'), the record number (sector number starting with 1) ('R'), and the sector shift value (0 = 128 bytes, 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes) ('N'). The -I option is mutually exclusive with all other options except -d device and -t trackno. -t trackno Specify the track number (cylinder number * number of heads + head number) to read the sector ID fields from; only allowed together with the -I numsects option. FILES
/dev/fd0 Default device to read from. EXIT STATUS
The fdread utility sets the exit value according to sysexits(3). In recovery mode, the exit value will be set to EX_IOERR if any error occurred during processing (even in quiet mode). DIAGNOSTICS
Unless running in quiet mode, upon encountering an error, the status of the floppy disc controller (FDC) will be printed out, both in hexa- decimal form, followed by a textual description that translates those values into a human-readable form for the most common error cases that can happen in a PC environment. The FDC error status includes the three FDC status registers 'ST0', 'ST1', and 'ST2', as well as the location of the error (physical cylin- der, head, and sector number, plus the ``sector shift value'', respectively). See the manual for the NE765 or compatible for details about the status register contents. The FDC's status is then examined to determine whether the error is deemed to be recoverable. If error recovery was requested, the location of the bad block in the output file is indicated by its (hexadecimal) bounds. Also, a summary line indicating the total number of transfer errors will be printed before exiting. SEE ALSO
dd(1), fdwrite(1), sysexits(3), fdc(4), fdcontrol(8) HISTORY
The fdread utility was written mainly to provide a means of recovering at least some of the data on bad media, and to obviate the need to invoke dd(1) with too many hard to memorize options that might be useful to handle a floppy. The command appeared in FreeBSD 5.0. AUTHORS
Program and man page by Jorg Wunsch. BUGS
Concurrent traffic on the second floppy drive located at the same FDC will make error recovery attempts pointless, since the FDC status obtained after a read error occurred cannot be guaranteed to actually belong to the erroneous transfer. Thus using option -r is only reli- able if device is the only active drive on that controller. No attempt beyond the floppy error retry mechanism of fdc(4) is made in order to see whether bad sectors could still be read without errors by trying multiple times. Bits that are (no longer) available on the floppy medium cannot be guessed by fdread. BSD
May 14, 2001 BSD
All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy