In shell scripting, a shell such as bash runs a file containing a list of commands (a script). The script is effectively a program and the shell is its interpreter.

learn more… | top users | synonyms

10
votes
3answers
9k views

How to run a script during boot as root

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically ...
10
votes
2answers
15k views

Why doesn't rc.local run all my commands, and what can I do about it?

I have the following rc.local script: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # ...
3
votes
4answers
213 views

What is this line at the top of many files?

I have seen many files which have this line as the first line in them. What exactly is this? #!/usr/bin/env python What does it mean? Why is it necessary?
3
votes
1answer
905 views

How to run a command at login?

I need to run the following command (with real parameters) after login: ssh -f user@example.com -L 54321:example.com:54321 -N I need it only for my user, not all users on the machine. Also, I need ...
0
votes
1answer
244 views

An alternative to init.d?

Is there an alternative to Ubuntu's init.d? Like a way of starting and stopping daemons that don't require those monstrous init.d scripts: # cat /etc/init.d/skeleton #! /bin/sh ### BEGIN INIT INFO # ...
5
votes
3answers
330 views

Convey some message to all users

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or ...
0
votes
2answers
524 views

Where to start in Linux programming [closed]

I am a student and I would like to study all these terminal stuffs and all. You all will be experts in this subject. I would like to know where did you all begin and what must I do to be an expert in ...
4
votes
8answers
455 views

How to sort by row from terminal

I was looking at this question and I wondered if the following could be done from terminal. I did it in python, just want to see if it could be done from terminal, bash scripting or whatever. ...
2
votes
3answers
1k views

Extracting a part of a massive csv file from command line

I want to read parts of a big csv file between rows n and m and between columns p and q. Is there an easy way to do this easily with the shell? (Are there commands I should read the doc's? otherwise, ...
4
votes
1answer
341 views

How to make a file executable? [duplicate]

How can I make my file so that I can double click on it, and it runs. It is a .sh script, but I also have files that say: executable (application/x-executable) in the description of what they are. ...
3
votes
1answer
395 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
3
votes
2answers
223 views

Getting values from variables - bash script

I am trying to write a bash script to print values of the 3 variables. Keep getting errors. What am I doing wrong? INPUT1=/tmp/dir1 INPUT2=/tmp/dir2 INPUT3=/tmp/dir3 for i in 1 2 3 do echo ...
1
vote
3answers
514 views

ubuntu 14.04 + gnome 3.10 + gnome-shell restart

Is there a way to ask gnome-shell to run a shell script every time it starts? (Like after a Alt+F2 then r, not on Login) NB: If you think it's about the start-up list, it's not : do a Alt+F2 then r ...
1
vote
1answer
66 views

How can I remove an entry from a list in a shells script?

I have the following script: #!/bin/bash # Bash Menu Script Example PS3='Please enter your choice: ' options=("Option 1" "Option 2" "Option 3" "Quit") select opt in "${options[@]}" do case $opt ...
0
votes
0answers
35 views

How to open reverse shell from NOWASP?

I'm using 12.04 LTS and the server is 12.04 LTS server. So, I'm teaching myself some pen testing and right now I'm trying to use netcat to open a reverse shell from nowasp, my nowasp is on a VM and ...
0
votes
1answer
4k views

Compilation error when installing Realtek 8192cu driver

I'm using a laptop with Ubuntu 13.04 64 bits. After "fighting" for some time, I gave up trying to have my Realtek 8188ce wireless card work properly (the wifi connection is annoyingly unstable). So I ...