user2670996
user2670996

Reputation: 2674

Bash script executing command with file lines as parameters

This file has the parameters:

root@moodle:/usr/src# cat plugins_filtered 
--release 2019042008 mod_bigbluebuttonbn
--release 2020020500 mod_hvp
--release 2020043003 block_xp

This are the commands I would like to execute:

root@moodle:/usr/src# while read in; do echo moosh plugin-install "$in"; done < /usr/src/plugins_filtered
moosh plugin-install --release 2019042008 mod_bigbluebuttonbn
moosh plugin-install --release 2020020500 mod_hvp
moosh plugin-install --release 2020043003 block_xp

If I go one by one everything works, if I remove the ok, I get errors:

root@moodle:/usr/src# while read in; do moosh plugin-install "$in"; done < /usr/src/plugins_filtered
Option 'release' requires a value.
Moosh global options should be passed before command not after it.Option 'release' requires a value.
Moosh global options should be passed before command not after it.Option 'release' requires a value.
Moosh global options should be passed before command not after it.root@moodle:/usr/src# 

Upvotes: 0

Views: 112

Answers (1)

Digvijay S
Digvijay S

Reputation: 2715

Try


while read in; do echo moosh plugin-install "$in" | bash; done < /usr/src/plugins_filtered

Upvotes: 1

Related Questions