All Questions
4 questions
4
votes
1
answer
4k
views
How do I join an array of strings where each string has spaces?
My bash script:
#!bin/bash
MY_ARRAY=("Some string" "Another string")
function join { local IFS="$1"; shift; echo -e "$*"; }
join "," ${MY_ARRAY[@]}
I want the output to be:
Some string,Another string....
4
votes
1
answer
13k
views
Problems creating array with newline separator
I'm building a function to find large directories on the filesystem and the /n is being cut off of /native/proc... in each of my array elements containing that path. I believe this has something to ...
6
votes
3
answers
4k
views
Passing multiple of arguments with whitespaces through a script to ssh
I want to remove multiple files from remote server. I have all files under one array in a script and I call other script which will remove files.
Let output of "${b[@]}" is:
/mnt/DataBK/...
7
votes
2
answers
8k
views
Splitting the working directory in a bash script
If I do:
IFS="/" read -ra PARTS
And type in a path manually, it creates the array "PARTS" as hoped, however:
IFS="/" read -ra PARTS <<< $(pwd)
creates an array with a single element, with ...