This shouldn’t be a fixed width string. Use delimited output options instead: ACCTLIST=$(sacctmgr show assoc where user=$INPUTUSER -n format=account%25 | sort -u)