Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I need a shell script file for Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support (LEMP) On Ubuntu 12.10. Can anyone direct me to create a shell script file to install these tools. Am new in creating shell script.
Your response should be appreciable!!!
Shell script is, basically, a file with commands you'd execute anyway by hand in command line.
Start with creating it, with the following contents:
#!/bin/bash
apt-get install ...
# do some other operations
Save it as script.sh. Now just change it's permissions, so it's executable:
$ chmod +x script.sh
Now it's ready to be invoked:
$ ./script.sh
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
When I try to build my project on the Mac I get the error: zsh: code not found: build.sh
I use IntelliJ and Docker.
Anyone have any idea how to fix this?
Tried some different things already:
Add permission to execute which you did already with chmod +x *.sh (try to avoid that since it gives permission to execute to all scripts, including ones that you don't want to be executable; Instead write specific file name - in your case chmod +x build.sh)
You can execute scripts with ./scriptname.sh for example ./build.sh - you did it before but without execute rights which now your script has.
Your shell doesn't know what is build.sh.
Execute this ./build.sh
If a file is not executable, you need to make it with this command sudo chmod +x build.sh
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Basically, I want to be able to have a command for my command-line "Net", kinda like the "Python" command used to start python.
So I'd like to have a command like "Net" or something to start my bash-script, but I don't want to go into my .bash_profile and make an alias, I want it to be created automatically if you just run a script.
How would this be done?
It seems like you're looking for the install command...
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/install.1.html
install -m 755 ./my-bash-script.sh /bin/net
Just be sure use a directory that is in your $PATH and that you don't already have an executable file in your $PATH that is using the name of the command you plan to use. 'net' is an actual command used on linux systems, but I'm not sure about the Mac.
If you add it to your bash script, you might want to add some sanity checks...
#! /bin/bash
...
...
[[ ! -f /bin/$(basename $0) ]] && install -m 755 $0 /bin/$(basename $0)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I logging into my server from the Mac Terminal Bash Shell and the unzip command is not working I keep getting the following message:
bash: unzip: command not found
Can I unzip a file via SSH from Mac Terminal?
The program unzip should be in /usr/bin:
$ type unzip
unzip is /usr/bin/unzip
Worst case, you can always just "ask for it by name":
$ /usr/bin/unzip foo.zip
You should check your PATH variable, as it should normally include /usr/bin:
$ echo $PATH
$ PATH=/bin:/usr/bin:$PATH
$ export PATH
Make sure you have selected a login shell for your Terminal. This will set a good value for the PATH variable when the shell starts.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
When I try to execute a command as super user that is followed by a path, the auto-complete (tab) will produce a whitespace after the folder:
Example, in my home folder:
"sudo cat Doc" <tab>
produces
"sudo cat Documents "
as opposed to
"sudo cat Documents/"
This is quite annoying. Any ideas what may be wrong? Did I break it or is this simply a bug?
I am running Linux Mint 13 Mate 64.
You can use bash-completion for the issue. For Debian/Ubuntu
sudo apt-get install bash-completion
This topic seems to fix it.
I am still unsure why this occurred though. I am quite certain it wasn't an issue until today.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to run some Java programs in the background when the system boots in Ubuntu. I have tried to add a script in /etc/init.d directory but failed to start a program. i.e programs are not started. What should I do for that?
First of all, the easiest way to run things at startup is to add them to the file /etc/rc.local.
Another simple way is to use #reboot in your crontab. Read the cron manpage for details.
However, if you want to do things properly, in addition to adding a script to /etc/init.d you need to tell ubuntu when the script should be run and with what parameters. This is done with the command update-rc.d which creates a symlink from some of the /etc/rc* directories to your script. So, you'd need to do something like:
update-rc.d yourscriptname start 2
However, real init scripts should be able to handle a variety of command line options and otherwise integrate to the startup process. The file /etc/init.d/README has some details and further pointers.