Score:-1

How to run commands written in text file in Ubuntu 20.04

gb flag

I just made a text file with the following commands to launch Xilinx Vivado software. How can I run this text file directly from the Terminal, so that I don't need to copy and paste all these commands in Terminal manually to run.

abc@alpha:source /Xilinx/Vivado/2021.1/settings64.sh
abc@alpha:source /Xilinx/Vitis/2021.1/settings64.sh
vivado
David avatar
cn flag
Research bash scripts.
engr_john avatar
gb flag
How to make bash script
engr_john avatar
gb flag
Yes it works. I just make a bash script and run it in the terminal.
Score:0
sn flag

There are 2 ways around this in my books.
First you can run it with bash as follows:

bash /Xilinx/Vivado/2021.1/settings64.sh
bash /Xilinx/Vitis/2021.1/settings64.sh

Or you can add #!/bin/bash as the first line of each script - then you can make that script executable with the chmod command.

chmod 770 /Xilinx/Vivado/2021.1/settings64.sh
chmod 770 /Xilinx/Vitis/2021.1/settings64.sh

Then you can execute the script directly in the directory it's in with

./settings64.sh

Or you can make a 3rd script that runs them 1 by one.

Hope this makes sense.

cn flag
security wise 750 is better ;-)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.