Skip to main content

All Questions

5 votes
3 answers
2k views

How to align the output generated in a shell "for" loop by columns

I'm trying to align output from a bash for loop. Currently, I'm getting output from my loop that looks like so: Directory: /some/long/directory/path Remote: some-remote Directory: /some/dir/path ...
PGEL's user avatar
  • 187
-1 votes
1 answer
4k views

how to use echo or printf with xargs to iterate over a list from a file?

In poking about with xargs, as here: nicholas@gondor:~/x$ nicholas@gondor:~/x$ xargs echo < list.txt 1 2 3 nicholas@gondor:~/x$ nicholas@gondor:~/x$ cat list.txt 1 2 3 nicholas@gondor:~/x$ how ...
Nicholas Saunders's user avatar
-2 votes
1 answer
2k views

Printf appending fails

I Tried to run the following similar commands in CentOS (12.x): printf "\nhello" "$HOME"/.bashrc printf "\nhello" ${HOME}/.bashrc After execution I display the content of the .bashrc file and see ...
Arcticooling's user avatar
3 votes
1 answer
1k views

How do I print hyphens if a variable is empty?

I am collecting windows system information using wmic on Linux system. For that purpose, I make various wmic calls and their output is stored in some variables. After required data is collected, I ...
Mandar Shinde's user avatar