A Question on BASH Scripting
I've used Linux for over a year now, maybe two, so I'm not a complete noob at Linux when it comes to day-to-day usage. I am, however, now getting into some scripting so I can make my life a bit easier when making Arch or Gentoo installs or just for self pleasure.
My question is this: is it possible for a script to execute another then continue executing the first script?
let me explain what I mean. When installing Gentoo and Arch, there is a step where you have to chroot and do stuff inside there. I know that if a run something like command_1 && chroot /mnt/drive && command_2 the second command will not run within the chroot.
I have made two scripts: Step one, which will run "command_1", then chroot, and finally, execute the second script — Step two.
Any help and criticism is welcomed.
Posted Apr 1, 2021, 6:47 PM UTC
According to the manpage for chroot you're supposed to put the commands you want to run after the newroot location. If it's one command you can probably do that easily enough, but if it's complicated, you'll probably want to create a script in the form of a here-document or do what you did and create a separate script file for it.
I know I’m late but this is exactly what I did to make it happen. Thank you very much for you help!
If that's the case, it seems like I can just run
chroot /mnt/drive /path/to/script2at the end of script1!Thanks for your help!