maybe its easier to read -r -a some On Thu, Dec 5, 2024, 6:13 PM microsuxxor <fxmb...@gmail.com> wrote:
> ~ $ eval set -- "$( IFS=' ' ; printf %q\ 1 two ' th r ee ' '$( four >&2 > )' )" ; printf -- -%s-\\t "$@" ; printf \\n > -1- -two- - th r ee - -$( four >&2 )- > > On Thu, Dec 5, 2024, 5:54 PM microsuxxor <fxmb...@gmail.com> wrote: > >> ~ $ IFS=' ' ; declare -a "a=( $( printf %q\ 1 two ' th r ee ' '$( four >> >&2 )' ) )" ; set -- "${a[@]}" ; printf -- -%s-\ \ "$@" ; printf \\n >> -1- -two- - th r ee - -$( four >&2 )- >> >> On Thu, Dec 5, 2024, 5:48 PM Chet Ramey <chet.ra...@case.edu> wrote: >> >>> On 12/5/24 9:41 AM, Clark Wang wrote: >>> > It would be easier to manipulate positional params if we can write like >>> > `printf -v 1`. >>> >>> Use an array. Use printf to write values to the array elements, then use >>> set -- "${array[@]}" (or "${array[@]:1}" depending on how closely you >>> want the array to parallel the positional parameters) to set the >>> positional >>> parameters. >>> >>> Chet >>> -- >>> ``The lyf so short, the craft so long to lerne.'' - Chaucer >>> ``Ars longa, vita brevis'' - Hippocrates >>> Chet Ramey, UTech, CWRU c...@case.edu >>> http://tiswww.cwru.edu/~chet/ >>> >>