How to find intermediates in symlink recursion?Do shells support recursion?How to run "find -exec...
Does Mathematica 12 support GT 730 CUDA?
Importance of moon phases for Apollo missions
Found more old paper shares from broken up companies
Strange LED behavior
Found old paper shares of Motorola Inc that has since been broken up
Why can't a country print its own money to spend it only abroad?
How does mathematics work?
If hash functions append the length, why does length extension attack work?
Count the identical pairs in two lists
How did pilots avoid thunderstorms and related weather before “reliable” airborne weather radar was introduced on airliners?
What does a Nintendo Game Boy do when turned on without a game cartridge inserted?
Did Don Young threaten John Boehner with a 10 inch blade to the throat?
Why is DC so, so, so Democratic?
Capture SQL Server queries without third-party tooling and without using deprecated features?
What does the following chess proverb mean: "Chess is a sea where a gnat may drink from and an elephant may bathe in."
Do I care if the housing market has gone up or down, if I'm moving from one house to another?
How can I disable a reserved profile?
Adding gears to my grandson's 12" bike
What is the best word describing the nature of expiring in a short amount of time, connoting "losing public attention"?
Why didn't NASA launch communications relay satellites for the Apollo missions?
Monday's Blocking Donimoes Problem
Why was Quirrell said to be in the Black Forest if Voldemort was actually in Albania?
Can a warlock shoot multiple beams from the Eldritch Blast cantrip with only a single free hand?
What are "the high ends of castles" called?
How to find intermediates in symlink recursion?
Do shells support recursion?How to run "find -exec <script> {};Symbolic link recursion - what makes it “reset”?nemo: Context Menu Action Triggering a Script that Forces the Selected Symbolic Link to be RelativeFind doesn't work with recursion?explain recursion syntaxHow to change du recursion orderimprove my bash script to find, remove and symlink directory treerecursion in bash going infinite loopFunction Recursion in shell
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Is there a non-recursive readlink -f
/ realpath
alternative, that outputs absolute symlink destinations? A more POSIX compatible solution is welcome as well.
I have a function block in my shell script as follows:
set FILES
# addFile adds a file to the FILES list. If file is a symlink,
# it will also find and add the destination.
addFile() {
file="$1"
# Check if file is already included in list
echo "$FILES" | grep -q "$file" && return
FILES="$FILES $file"
if [ -L $file ]; then
addFile $(realpath $file)
#addFile $(readlink $file)
fi
}
I'm using this function in a script which is collecting binary and library files from around the file system. But I foresee a problem in this code:
- My first try I used
readlink
, but this returned symlink resolution paths relative to the$file
, thus any actions performed on those paths fail. (Now commented out, but still in code) (See minor edit below) - After that, I used
realpath
instead, as suggested byman readlink
. It almost works.
Now, the actions that I want to perform can work. However, in the final result I'm copying over all the binaries, libraries and symlinks in an initramfs. If there are any recursive symlinks, only the top level and the destination will be included, not the intermediate ones. Thus, breaking the symlink.
I've created a fiddle to demonstrate the issue. link-to-link1
points to link1
, which points to file1
. In the end result link1
is missing and link-to-link1
is broken.
Edit; clarify the issue
When running the above function on the following set of symlinks:
# Contents of ~/test/src
file0
file1
link0 -> file0
link0.1 -> file0
link1 -> file1
link-to-link1 -> link1
With:
copy="link-to-link1 link0 link0.1"
for sf in $copy; do
addFile ~/test/src/$sf
done;
cp -av $FILES ~/test/dst
You will find that only the 3 links from $copy
and 2 files are copied. However, intermediate link link1
is missing and link-to-link1
is broken.
I would like the script to find link1
as well. Keeping in mind that in the environment where this script is run, the location of files and symlinks have to be absolute.
Minor edit
Add another fiddle to demonstrate failing of relative paths, using readlink
. Only the symlinks are copied and the destinations are missing.
bash shell-script shell
add a comment |
Is there a non-recursive readlink -f
/ realpath
alternative, that outputs absolute symlink destinations? A more POSIX compatible solution is welcome as well.
I have a function block in my shell script as follows:
set FILES
# addFile adds a file to the FILES list. If file is a symlink,
# it will also find and add the destination.
addFile() {
file="$1"
# Check if file is already included in list
echo "$FILES" | grep -q "$file" && return
FILES="$FILES $file"
if [ -L $file ]; then
addFile $(realpath $file)
#addFile $(readlink $file)
fi
}
I'm using this function in a script which is collecting binary and library files from around the file system. But I foresee a problem in this code:
- My first try I used
readlink
, but this returned symlink resolution paths relative to the$file
, thus any actions performed on those paths fail. (Now commented out, but still in code) (See minor edit below) - After that, I used
realpath
instead, as suggested byman readlink
. It almost works.
Now, the actions that I want to perform can work. However, in the final result I'm copying over all the binaries, libraries and symlinks in an initramfs. If there are any recursive symlinks, only the top level and the destination will be included, not the intermediate ones. Thus, breaking the symlink.
I've created a fiddle to demonstrate the issue. link-to-link1
points to link1
, which points to file1
. In the end result link1
is missing and link-to-link1
is broken.
Edit; clarify the issue
When running the above function on the following set of symlinks:
# Contents of ~/test/src
file0
file1
link0 -> file0
link0.1 -> file0
link1 -> file1
link-to-link1 -> link1
With:
copy="link-to-link1 link0 link0.1"
for sf in $copy; do
addFile ~/test/src/$sf
done;
cp -av $FILES ~/test/dst
You will find that only the 3 links from $copy
and 2 files are copied. However, intermediate link link1
is missing and link-to-link1
is broken.
I would like the script to find link1
as well. Keeping in mind that in the environment where this script is run, the location of files and symlinks have to be absolute.
Minor edit
Add another fiddle to demonstrate failing of relative paths, using readlink
. Only the symlinks are copied and the destinations are missing.
bash shell-script shell
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10
add a comment |
Is there a non-recursive readlink -f
/ realpath
alternative, that outputs absolute symlink destinations? A more POSIX compatible solution is welcome as well.
I have a function block in my shell script as follows:
set FILES
# addFile adds a file to the FILES list. If file is a symlink,
# it will also find and add the destination.
addFile() {
file="$1"
# Check if file is already included in list
echo "$FILES" | grep -q "$file" && return
FILES="$FILES $file"
if [ -L $file ]; then
addFile $(realpath $file)
#addFile $(readlink $file)
fi
}
I'm using this function in a script which is collecting binary and library files from around the file system. But I foresee a problem in this code:
- My first try I used
readlink
, but this returned symlink resolution paths relative to the$file
, thus any actions performed on those paths fail. (Now commented out, but still in code) (See minor edit below) - After that, I used
realpath
instead, as suggested byman readlink
. It almost works.
Now, the actions that I want to perform can work. However, in the final result I'm copying over all the binaries, libraries and symlinks in an initramfs. If there are any recursive symlinks, only the top level and the destination will be included, not the intermediate ones. Thus, breaking the symlink.
I've created a fiddle to demonstrate the issue. link-to-link1
points to link1
, which points to file1
. In the end result link1
is missing and link-to-link1
is broken.
Edit; clarify the issue
When running the above function on the following set of symlinks:
# Contents of ~/test/src
file0
file1
link0 -> file0
link0.1 -> file0
link1 -> file1
link-to-link1 -> link1
With:
copy="link-to-link1 link0 link0.1"
for sf in $copy; do
addFile ~/test/src/$sf
done;
cp -av $FILES ~/test/dst
You will find that only the 3 links from $copy
and 2 files are copied. However, intermediate link link1
is missing and link-to-link1
is broken.
I would like the script to find link1
as well. Keeping in mind that in the environment where this script is run, the location of files and symlinks have to be absolute.
Minor edit
Add another fiddle to demonstrate failing of relative paths, using readlink
. Only the symlinks are copied and the destinations are missing.
bash shell-script shell
Is there a non-recursive readlink -f
/ realpath
alternative, that outputs absolute symlink destinations? A more POSIX compatible solution is welcome as well.
I have a function block in my shell script as follows:
set FILES
# addFile adds a file to the FILES list. If file is a symlink,
# it will also find and add the destination.
addFile() {
file="$1"
# Check if file is already included in list
echo "$FILES" | grep -q "$file" && return
FILES="$FILES $file"
if [ -L $file ]; then
addFile $(realpath $file)
#addFile $(readlink $file)
fi
}
I'm using this function in a script which is collecting binary and library files from around the file system. But I foresee a problem in this code:
- My first try I used
readlink
, but this returned symlink resolution paths relative to the$file
, thus any actions performed on those paths fail. (Now commented out, but still in code) (See minor edit below) - After that, I used
realpath
instead, as suggested byman readlink
. It almost works.
Now, the actions that I want to perform can work. However, in the final result I'm copying over all the binaries, libraries and symlinks in an initramfs. If there are any recursive symlinks, only the top level and the destination will be included, not the intermediate ones. Thus, breaking the symlink.
I've created a fiddle to demonstrate the issue. link-to-link1
points to link1
, which points to file1
. In the end result link1
is missing and link-to-link1
is broken.
Edit; clarify the issue
When running the above function on the following set of symlinks:
# Contents of ~/test/src
file0
file1
link0 -> file0
link0.1 -> file0
link1 -> file1
link-to-link1 -> link1
With:
copy="link-to-link1 link0 link0.1"
for sf in $copy; do
addFile ~/test/src/$sf
done;
cp -av $FILES ~/test/dst
You will find that only the 3 links from $copy
and 2 files are copied. However, intermediate link link1
is missing and link-to-link1
is broken.
I would like the script to find link1
as well. Keeping in mind that in the environment where this script is run, the location of files and symlinks have to be absolute.
Minor edit
Add another fiddle to demonstrate failing of relative paths, using readlink
. Only the symlinks are copied and the destinations are missing.
bash shell-script shell
bash shell-script shell
edited 57 mins ago
Pang
1671 silver badge6 bronze badges
1671 silver badge6 bronze badges
asked May 24 '18 at 16:56
TimTim
6463 silver badges13 bronze badges
6463 silver badges13 bronze badges
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10
add a comment |
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10
add a comment |
1 Answer
1
active
oldest
votes
If I understand right, for the example given, you want link1
for the file link-to-link1
. That you can get using GNU find
's -printf
and %l
:
$ find . -type l -printf '%p -> %ln'
./link0.1 -> file0
./link1 -> file1
./link0 -> file0
./link-to-link1 -> link1
Since the absolute path of link1
is needed as the output for /path/to/link-to-link1
, maybe cd
to the directory containing link-to-link1
and run readlink
/realpath
in succession:
(
cd "$(dirname "$file")"
realpath -s "$(readlink "$file")"
)
realpath -s
does not resolve symbolic links, but will print the absolute path.
For example:
~ file=/tmp/foo/link-to-link1
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
This will also work for links to absolute paths:
~ file=/tmp/foo/link2
~ ln -sfv /tmp/foo/link1 "$file"
'/tmp/foo/link2' -> '/tmp/foo/link1'
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
find
'sprintf
and%l
is giving a relative link, just likereadlink
. The problem being, if the links are not in the$PWD
,addFile()
will try to add a non-existing file. Hence, I resorted torealpath
for absolute names, but that one's recursive and missing intermediate links.
– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f445812%2fhow-to-find-intermediates-in-symlink-recursion%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If I understand right, for the example given, you want link1
for the file link-to-link1
. That you can get using GNU find
's -printf
and %l
:
$ find . -type l -printf '%p -> %ln'
./link0.1 -> file0
./link1 -> file1
./link0 -> file0
./link-to-link1 -> link1
Since the absolute path of link1
is needed as the output for /path/to/link-to-link1
, maybe cd
to the directory containing link-to-link1
and run readlink
/realpath
in succession:
(
cd "$(dirname "$file")"
realpath -s "$(readlink "$file")"
)
realpath -s
does not resolve symbolic links, but will print the absolute path.
For example:
~ file=/tmp/foo/link-to-link1
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
This will also work for links to absolute paths:
~ file=/tmp/foo/link2
~ ln -sfv /tmp/foo/link1 "$file"
'/tmp/foo/link2' -> '/tmp/foo/link1'
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
find
'sprintf
and%l
is giving a relative link, just likereadlink
. The problem being, if the links are not in the$PWD
,addFile()
will try to add a non-existing file. Hence, I resorted torealpath
for absolute names, but that one's recursive and missing intermediate links.
– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
add a comment |
If I understand right, for the example given, you want link1
for the file link-to-link1
. That you can get using GNU find
's -printf
and %l
:
$ find . -type l -printf '%p -> %ln'
./link0.1 -> file0
./link1 -> file1
./link0 -> file0
./link-to-link1 -> link1
Since the absolute path of link1
is needed as the output for /path/to/link-to-link1
, maybe cd
to the directory containing link-to-link1
and run readlink
/realpath
in succession:
(
cd "$(dirname "$file")"
realpath -s "$(readlink "$file")"
)
realpath -s
does not resolve symbolic links, but will print the absolute path.
For example:
~ file=/tmp/foo/link-to-link1
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
This will also work for links to absolute paths:
~ file=/tmp/foo/link2
~ ln -sfv /tmp/foo/link1 "$file"
'/tmp/foo/link2' -> '/tmp/foo/link1'
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
find
'sprintf
and%l
is giving a relative link, just likereadlink
. The problem being, if the links are not in the$PWD
,addFile()
will try to add a non-existing file. Hence, I resorted torealpath
for absolute names, but that one's recursive and missing intermediate links.
– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
add a comment |
If I understand right, for the example given, you want link1
for the file link-to-link1
. That you can get using GNU find
's -printf
and %l
:
$ find . -type l -printf '%p -> %ln'
./link0.1 -> file0
./link1 -> file1
./link0 -> file0
./link-to-link1 -> link1
Since the absolute path of link1
is needed as the output for /path/to/link-to-link1
, maybe cd
to the directory containing link-to-link1
and run readlink
/realpath
in succession:
(
cd "$(dirname "$file")"
realpath -s "$(readlink "$file")"
)
realpath -s
does not resolve symbolic links, but will print the absolute path.
For example:
~ file=/tmp/foo/link-to-link1
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
This will also work for links to absolute paths:
~ file=/tmp/foo/link2
~ ln -sfv /tmp/foo/link1 "$file"
'/tmp/foo/link2' -> '/tmp/foo/link1'
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
If I understand right, for the example given, you want link1
for the file link-to-link1
. That you can get using GNU find
's -printf
and %l
:
$ find . -type l -printf '%p -> %ln'
./link0.1 -> file0
./link1 -> file1
./link0 -> file0
./link-to-link1 -> link1
Since the absolute path of link1
is needed as the output for /path/to/link-to-link1
, maybe cd
to the directory containing link-to-link1
and run readlink
/realpath
in succession:
(
cd "$(dirname "$file")"
realpath -s "$(readlink "$file")"
)
realpath -s
does not resolve symbolic links, but will print the absolute path.
For example:
~ file=/tmp/foo/link-to-link1
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
This will also work for links to absolute paths:
~ file=/tmp/foo/link2
~ ln -sfv /tmp/foo/link1 "$file"
'/tmp/foo/link2' -> '/tmp/foo/link1'
~ (cd "$(dirname "$file")"; realpath -s "$(readlink "$file")")
/tmp/foo/link1
edited May 25 '18 at 8:07
answered May 25 '18 at 7:20
murumuru
42.2k5 gold badges103 silver badges177 bronze badges
42.2k5 gold badges103 silver badges177 bronze badges
find
'sprintf
and%l
is giving a relative link, just likereadlink
. The problem being, if the links are not in the$PWD
,addFile()
will try to add a non-existing file. Hence, I resorted torealpath
for absolute names, but that one's recursive and missing intermediate links.
– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
add a comment |
find
'sprintf
and%l
is giving a relative link, just likereadlink
. The problem being, if the links are not in the$PWD
,addFile()
will try to add a non-existing file. Hence, I resorted torealpath
for absolute names, but that one's recursive and missing intermediate links.
– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
find
's printf
and %l
is giving a relative link, just like readlink
. The problem being, if the links are not in the $PWD
, addFile()
will try to add a non-existing file. Hence, I resorted to realpath
for absolute names, but that one's recursive and missing intermediate links.– Tim
May 25 '18 at 7:38
find
's printf
and %l
is giving a relative link, just like readlink
. The problem being, if the links are not in the $PWD
, addFile()
will try to add a non-existing file. Hence, I resorted to realpath
for absolute names, but that one's recursive and missing intermediate links.– Tim
May 25 '18 at 7:38
@Tim check the update
– muru
May 25 '18 at 8:07
@Tim check the update
– muru
May 25 '18 at 8:07
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f445812%2fhow-to-find-intermediates-in-symlink-recursion%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you give an example and the output you want for that in the question? As an aside: consider using an associative array to store the list of files, since you're using bash.
– muru
May 25 '18 at 7:05
@muru, Did you check the linked fiddle? I attached that as a longer example. If that on'e not clear enough, I'll try to make some adjustments.
– Tim
May 25 '18 at 7:07
I'm looking at it, but it's a) better for the post to be self-contained and b) we shouldn't have to parse whatever you did to create the state in addition to whatever you're going to do with that state. So it's better if you can describe the input and the output you want in the question.
– muru
May 25 '18 at 7:08
Ok, will try to clarify the question
– Tim
May 25 '18 at 7:10