Skip to main content

All Questions

Tagged with
1 vote
4 answers
114 views

Need shell script help - processing the same option multiple times

So I've ran into a bit of a wall, I have an option in my script that calls a function which allows me to specify a file/directory and then I want to parse that output into a menu tool (using dmenu in ...
hollowillow's user avatar
4 votes
4 answers
479 views

How to sort the list of positional parameters in POSIX sh

Is there a way to sort the list of positional parameters in POSIX sh? Each positional parameter could contain arbitrary characters (e.g. spaces, newlines, tabs, etc.). The sort algorithm should be ...
Flux's user avatar
  • 3,198
1 vote
2 answers
1k views

Is there a way to modify $@ array in a POSIX shell script

I may know how to use readlink to get normal files from SymLinks. I had this very basic idea to replace any SymLink in $@ passed to my function as follows: for file in "$@"; do [ -L "$file" ] &...
Vlastimil Burián's user avatar
2 votes
2 answers
2k views

How to join elements of an array in POSIX delimited by a space?

The following works in a Bash script: PACKAGES=( 'curl' 'git' 'htop' 'mc' 'tree' 'vim' ) apt --yes install ${PACKAGES[@]} But how can I do the same in POSIX so that I can use ...
rfgamaral's user avatar
  • 475
10 votes
2 answers
8k views

How to use pseudo-arrays in POSIX shell script?

How to use pseudo-arrays in POSIX shell script? I want to replace an array of 10 integers in a Bash script with something similar into POSIX shell script. I managed to come across Rich’s sh (POSIX ...
Vlastimil Burián's user avatar