8

I have a bunch of commands seperated by \ns that I'd like to execute serially (from the command line) in a file called ec2-env-setup. I'd appreciate any help.

4 Answers 4

15

This is called a script.

Right click on the text file, select properties, select permission, mark the "Let this file be executed" text box. Now you can execute it just by double clicking on the file.

You can also do it from the console like this:

sh ec2-env-setup.

Or change the permissions and afterwards execute it:

chmod u+x ec2-env-setup.
./ec2-env-setup.
6

You need to make it excecutable:

chmod +x ec2-env-setup

And then run it (this will work if you are in the same directory as it, otherwise, use an absolute path).

./ec2-env-setup
3

Just for future reference, and to counter some of the command-line love going on here :-) you can also open the Properties of the file, select the Permissions pane and enable the Executable flags. If you then double-click the file, it'll let you run it as a script.

You might want to run it in the Terminal though if you'd like to see the output.

You can also create a Launcher. Right click on the Desktop and select Create Launcher to do that.

1

well i will answer my own question i posted here before and deleted as i found the answer. my file did not execute but just openend...

if file does not execute you might need to set preferences. for that: click any folder, go to menu edit, choose preferences,click behavior tab, check "run executable textfiles when they are opened". doubble click the file to execute...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .