11-16-2019
I'd trust the system when it complains a file not residing where it looks for it.
Did you make very sure that file exists?
What happens in your script is that
bash's
mapfile /
readarray builtin is duplicated by using a "command substitution".
man bash:
Quote:
The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).
Above mentioned builtins serve the same purpose, offer some more options, and don't rely on the deprecated, dangerous
eval command.
man bash:
Quote:
mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
Read lines from the standard input into the indexed array variable array
Why don't you just abandon the function?
Last edited by RudiC; 11-16-2019 at 03:30 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a little script to help me manage a gallery of image files. It makes symbolic links to every file in and below the current directory, placing them in a target directory which is passed to the script as a parameter. Unfortunately, the script pukes when I pass a parameter that contains... (4 Replies)
Discussion started by: TanRanger
4 Replies
2. UNIX for Advanced & Expert Users
If have
var='$variable'
how can I expand $variable.
I have tried many thing like duble quotes/braces etc, but nothing worked.
I need the solution ASAP. (2 Replies)
Discussion started by: Bsk
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
The following code finds the line containing fruits in test.txt and replaces instances of apple with banana.
ed -s test.txt <<< $'/fruits/s/apple/banana/g\nw'
What I want to do is put variables in the place of fruits, apple and banana.
I have tried replacing ' with " to get... (2 Replies)
Discussion started by: de_la_espada
2 Replies
4. Shell Programming and Scripting
Hi,
I need some direction with the following. The below code is semi-psuedo code which will hopefully make it easier to understand what I am trying to achieve:
for i in `echo ${testarray
}`
do
let c=c+1
eval "first$c=$i"
while... (4 Replies)
Discussion started by: yonderboy
4 Replies
5. Shell Programming and Scripting
Hello,
so i'm making a script, using dynamic variables and trying to expand them. So far it hasn't worked out too well so it seems that I need some help from you, the elite.
Example:
#!/bin/sh
counter=0
until (($counter>5))
counter2=1
until (($counter2>6)); do
if ;... (5 Replies)
Discussion started by: TehOne
5 Replies
6. Shell Programming and Scripting
Hi Guys,
I have an issue with awk and variables. I have trawled the internet and forums but can't seem to get the exactt syntax I need.
I have tried using awk -v and all sorts of variations but I have hit a brick wall. I have spent a full day on this and am just going round in circles.
... (3 Replies)
Discussion started by: gazza-o
3 Replies
7. Shell Programming and Scripting
anyone has any info on why this is complaining???
vivek@vivek-c5e55ef2e ~/TAC
$ zoneCounter=1
vivek@vivek-c5e55ef2e ~/TAC
$ optUsage1=23%
vivek@vivek-c5e55ef2e ~/TAC
$ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>"
-bash: syntax error... (1 Reply)
Discussion started by: vivek d r
1 Replies
8. Shell Programming and Scripting
anyone has any info on why this is complaining???
vivek@vivek-c5e55ef2e ~/TAC
$ zoneCounter=1
vivek@vivek-c5e55ef2e ~/TAC
$ optUsage1=23%
vivek@vivek-c5e55ef2e ~/TAC
$ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>"
-bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies
9. Shell Programming and Scripting
My OS is Linux (kernel 4.08.something) and AIX (7100-04-01-1543), the used ksh versions are:
ksh88: Version M-11/16/88f (AIX)
ksh93: Version M 93t+ 2009-05-01 (AIX), Version M 93u (Linux)
When writing a parser for stanza files in ksh i encountered a rather strange behavior. Here is a... (4 Replies)
Discussion started by: bakunin
4 Replies
10. UNIX for Beginners Questions & Answers
I pass an argument to bash as run. The first command in green executes as expected, however the second in blue fails as the $run does not expand. I tried to escape the variable with \ thinking the quotes were making the literal translation and also "${run}" but both did not work to expand the... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT NETBSD
mount_umap
MOUNT_UMAP(8) BSD System Manager's Manual MOUNT_UMAP(8)
NAME
mount_umap -- user and group ID remapping file system layer
SYNOPSIS
mount_umap [-o options] -g gid-mapfile -u uid-mapfile target mount-point
DESCRIPTION
The mount_umap command is used to mount a sub-tree of an existing file system that uses a different set of uids and gids than the local sys-
tem. Such a file system could be mounted from a remote site via NFS, a local file system on removable media brought from some foreign loca-
tion that uses a different user/group database, or could be a local file system for another operating system which does not support Unix-
style user/group IDs, or which uses a different numbering scheme.
Both target and mount-point are converted to absolute paths before use.
The options are as follows:
-g gid-mapfile
Use the group ID mapping specified in gid-mapfile. This flag is required.
-o Options are specified with a -o flag followed by a comma separated string of options. See the mount(8) man page for possible options
and their meanings.
-u uid-mapfile
Use the user ID mapping specified in uid-mapfile. This flag is required.
The mount_umap command uses a set of files provided by the user to make correspondences between uids and gids in the sub-tree's original
environment and some other set of ids in the local environment. For instance, user smith might have uid 1000 in the original environment,
while having uid 2000 in the local environment. The mount_umap command allows the subtree from smith's original environment to be mapped in
such a way that all files with owning uid 1000 look like they are actually owned by uid 2000.
target should be the current location of the sub-tree in the local system's name space. mount-point should be a directory where the mapped
subtree is to be placed. uid-mapfile and gid-mapfile describe the mappings to be made between identifiers.
The format of the user and group ID mapping files is very simple. The first line of the file is the total number of mappings present in the
file. The remaining lines each consist of two numbers: the ID in the mapped subtree and the ID in the original subtree.
For example, to map uid 1000 in the original subtree to uid 2000 in the mapped subtree:
1
2000 1000
For user IDs in the original subtree for which no mapping exists, the user ID will be mapped to the user ``nobody''. For group IDs in the
original subtree for which no mapping exists, the group ID will be mapped to the group ``nobody''.
There is a limit of 64 user ID mappings and 16 group ID mappings.
The mapfiles can be located anywhere in the file hierarchy, but they must be owned by root, and they must be writable only by root.
mount_umap will refuse to map the sub-tree if the ownership or permissions on these files are improper. It will also report an error if the
count of mappings in the first line of the map files is not correct.
SEE ALSO
mount(8), mount_null(8)
HISTORY
The mount_umap utility first appeared in 4.4BSD.
BUGS
The implementation is not very sophisticated.
BSD
March 6, 2001 BSD