Bash is the shell used in Ubuntu's command-line interface.

learn more… | top users | synonyms (1)

0
votes
0answers
9 views

Run some shell files from another shell file in different location

I have 5 shell files in a specific locations on my ubuntu system. I have two users on this system userA which is the main user and userB. Currently I have to manually open a terminal using user userA ...
1
vote
3answers
52 views

Why is the output of _$ _ when executed on a terminal?

I have executed the following command sequence: $ now=$(date) $ echo _$now_ _ $ echo _ $now _ _ Mon Sep 22 09:53:44 IST 2014 _ Why is the output of _$now_ only _?
15
votes
3answers
7k views

How can a script check if it's being run as root?

I'm writing a simple bash script, but I need it to check whether it's being run as root or not. I know there's probably a very simple way to do that, but I have no idea how. Just to be clear: What's ...
2
votes
1answer
74 views

Stopping a running script though another script file

I am new to shell scripts. Say, I start a script like this. This runs for 3 days. So, I will start the script remotely through ssh and then close my local terminal. start.sh end=$((SECONDS+259200)) ...
-1
votes
1answer
13 views

Redirected Output

I just used a command ls -l > ~/ls_output in my /usr/bin directory and I'm not sure what happened. The terminal accepted my command but I don't know what happened to the output or where it went. ...
2
votes
2answers
725 views

Configure bash to print exit status of every command entered

Every command that I type on bash returns with an exit code. I want: Whenever I type a command on bash prompt, I want it to exit and print exit status i.e. echo $?. e.g. if I run echo "hello"; on ...
0
votes
0answers
18 views

Reading from /dev/urandom outputs a list of files in the current directory; why?

So I was playing around with /dev/urandom, and trying to sample one random character from it like so: read -N1 < /dev/urandom I know there are other ways to sample some randomness like the ...
-4
votes
3answers
772 views

how to check if $1 and $2 are null?

I am running some script which passing the string argument and I want to do if else statement shown as below: if [ $1 != '' ] && [ $2 != '' ] then do something..... but it shown Error ...
1
vote
1answer
19 views

Can't Change power_method 14.04

I am trying to modify my power method for my ati card as it's like having a helicopter in the room. I use the same methods described here. sudo bash -c echo "profile" > ...
6
votes
2answers
481 views

What's the use of complete command?

While running the complete command on my gnome-terminal, it shows some commands.What are they? And what is the use of complete command? $ complete complete -F _minimal complete -F _filedir_xspec ...
0
votes
2answers
127 views

Launcher for programs which need multiple commands to run

I already installed a program called CadFeko, and I can run it from terminal. To run the program, first I have to run this command . /opt/feko/6.3/bin/initfeko Then I can call the program by ...
0
votes
1answer
55 views

shell script to function on subfolders

I want to write a simple shell script that will go into all the sub-folders in a directory, and organise the files in the sub-folders into new directories. Basically in terminal it would look like: ...
3
votes
2answers
81 views

Sending enter in interaction mode ubuntu 13.10

I'm trying to make a basic script for deployment of ocs-inventory and I got stuck on a problem. When I issue this command: sudo apt-get install -y ocsinventory-agent The interactive window ...
1
vote
1answer
193 views

Bash script for execute one command for many files

I just tried to clear my holiday video stuff and found program for stibilizng vision. There are a lot of files so I made script to stabilize all. Firstly I need to run command: transcode -J ...
-1
votes
1answer
34 views

Ubuntu 14.04 - Desktop icon is not running my BASH script

I have a simple script runme.sh which works when i run from terminal. #!/bin/bash chromium-browser "https://askubuntu.com/" But i need to make it now runnable for normal Users. So i place a desktop ...
2
votes
1answer
14 views

post-receive: No such file or directory

I'm getting an error when trying to push to a remote Amazon EC2 (Ubuntu Linux) instance. I've given all related directories and files full permissions. I'm trying to use a post-receive hook to move ...
1
vote
2answers
61 views

Only display a range of entries from the bash history

Is it possible to set a fixed number for the "history" command to only show a certain amount of history items like 100, instead of everything from the beginning of time?
1
vote
2answers
38 views

Unable to delete file

I am unable to delete file: sudo rm /usr/local/bin/Katy Perry - Dark Horse (Official) ft. Juicy J-0KSOMA3QBU0.mp4.part It is showing an error: bash: syntax error near unexpected token `(' How to ...
1
vote
2answers
282 views

how to write a script that will execute xampp start and stop

I am trying to write a script that will enable xampp start and xampp stop with the same script without having to write in the terminal everytime. To start xampp, I write in console : sudo ...
1
vote
0answers
46 views

Display running clock in terminal [duplicate]

I want to display running clock inside terminal. I have already gone through this answer but this method only works in zsh terminal. But I want to display in bash. Is there any other way to display ...
6
votes
1answer
642 views

Difference between cd / and cd //? [duplicate]

What is the difference between cd / and cd //? We can see that adding / to the end doesn't do anything. But when I do cd // and pwd, I found: $ cd // $ pwd // What is difference between / and ...
19
votes
1answer
26k views

'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the ...
10
votes
5answers
867 views

How can I run original command that aliased with same name?

An alias for ls command in ~/.bashrc file aliased with this one: alias ls='ls --color=auto' then, when I run ls command in terminal aliased ls(ls --color=auto) runs. but my question is how can I ...
1
vote
2answers
52 views

Hide stdout of a process only when it is running in background

How could I hide the standard output of a process only when it is running in background? For example, test.sh #!/bin/bash for i in $(seq 200); do echo $i done Now, I run the script. I stop ...
0
votes
4answers
33 views

Explain exec in simple terms?

I don't understand the bash command exec. I have seen it used inside scripts to redirect all output to a file (see ...
3
votes
3answers
11k views

How to get separate with space or tab in the awk example

while I'm playing with awk I came to execute like ls -la >> a.txt ; awk {'print $5 $1'} a.txt ; then its giving output like 53277-rw------- 52347-rw------- how can I get space between ...
0
votes
0answers
14 views

Run script in another opened terminal

Is it possible to run a script in another opened terminal? In that case I would need to know all opened ttys. Another case would be, if I'm using SSH to login into a remote host. I would like to run ...
1
vote
3answers
53 views

Git prompt won't colorize

I want my git prompt in bash to colorize (green for clean repos, red for dirty repos). Right now, it shows plain white text no matter the git state of my cwd/repo. ...
3
votes
1answer
41 views

How to quickly check the value of bash variables, aliases and history commands from terminal?

How do you expand in place: bash aliases environment variables history commands to edit them and check they are correct? For example, I have some aliases I use for flashing different devices and ...
2
votes
2answers
43 views

Pass variable value to script from terminal

I like the shred command so instead of using the 'rm' command I prefer shred. I would like to create a bash script in /usr/bin, say we will call it "shredder" so that if I want to shred a file (i.e. ...
4
votes
4answers
255 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 ...
4
votes
2answers
158 views

Creating a new subdirectory in multiple existing directories

I am trying to figure out an elegant way to create a new subdirectory in a series of existing directories. I have 15 already created directories called Week1 through Week15. Within those ...
1
vote
2answers
4k views

Create zip of folder with same name

I want to create zip of a folder from command-line. I can do something like zip -r folder.zip folder. I want to give the zipped folder same name as the original folder. I can simulate this by writing ...
0
votes
1answer
166 views

when building u-boot /bin/bash: arm-none-linux-gnueabi-gcc: command not found

I am currently running Ubuntu 12.0.4 on a 64 bit machine. I have an AM335X development board. Along with the kit came the compressed kernel (linux 3,2), rootfs, u-boot, and ARM cross compiler ...
1
vote
0answers
36 views

“sudo !!” doesn't give me permissions. What am I missing? [duplicate]

When you forgot to sudo a command you may want to write, sudo !! That would execute the last command applying the sudo command to it. However sometimes seems I can't do that, for example inside ...
17
votes
7answers
1k views

Decompressing multiple files at once

I have more than 200 .zip files in one folder. I don't want to decompress those one by one. I want to extract those using single command or script. How to do that.
1
vote
1answer
30 views

Crontab not executing jobs Ubuntu 14.04

I am trying to run bash script as a cron job every 15 minutes. The bash script simple calls a Java program. I made an entry in crontab to run the file every 15 minutes and saved it but it would not ...
1
vote
3answers
65 views

Not able to run sed on bash script

I am working trough some legacy code which does not work, I came across a part that is causing problems. I was hoping some one could help me out and fill me in on what is the exact functionality of ...
7
votes
5answers
588 views

stdin/stdout- How to send a file as an input to another file?

Through the command shell we can redirect the three standard filestreams so that we can get input from either a file or another command instead of from our keyboard, and we can write output and errors ...
0
votes
1answer
19 views

CPU performance on sleep command

This is rather a beginner question. I wonder what happens when sleep command is triggered from a bash script, for example. That job would still running, with less priority?
0
votes
0answers
43 views

Diffrence beetween ' and " in bash [duplicate]

Please bear with my stupid question. I want to know the difference between ' and " in bash. Please explain it to me with an example.
0
votes
4answers
53 views

Creating a symbolic link to a directory

I have a directory to which I want to create a symbolic link. The commands I used were: cd workspace_b4a cd android-sdk-linux ln -sv build-tools/20.0.0/lib/ platform-tools/lib The output was: ...
8
votes
2answers
28k views

Compress in .tgz

I want to compress files in .tgz. I know how to make tar.gz(with tar and gzip) and some people say it is almost the same, but I need to make a .tgz, how??
0
votes
2answers
50 views

Bash script special character and background job bug

gnome-terminal --tab -e " sh -c ' gedit'/media/ubuntuman/Onces And for Al/scripts/faceBook' & ; sudo cpulimit -e ubuntu-tweak -l 80;'" This is the piece of code I want to edit. The special ...
-1
votes
1answer
40 views

How to let bash script knows if the open terminal is closed or not

I want to write piece of bash script that open a gnome-terminal tab and execute some commands in it after finishing execution terminal will close , i would like the make bash recognize if this ...
0
votes
1answer
45 views

bash: /etc/bash.bashrc: Permission denied I have no name!@lappyname:~$

During resolving another problem I run this command : pkexec chmod 0440 /etc/sudoers pkexec chmod 0440 /etc/sudoers.d/README mount -o remount,rw / Than after error occurs and after reopen the ...
1
vote
1answer
25 views

Can't trap (Ctrl^C) in my simple script

I don't know why I can't trap Ctrl^C in this simple script. #!/bin/bash for number in $(seq 10); do echo -n "." sleep 2 done function finish() { echo "bye." } trap finish ...
0
votes
2answers
751 views

Zenity progress bar and output

I wrote this little script: response=$(process ...) | zenity --progress --pulsate echo $response I want read the response of the process, whatever it is, and show a pulsating progress bar in the ...
7
votes
2answers
163 views

Can I run bash commands from an Ubuntu HTML5 App?

I want to convert some bash scripts into GUI apps using the Ubuntu SDK to create an HTML5 app. Is this possible? Are there any tutorials besides the 'Meanings' one that demonstrate this?
1
vote
2answers
47 views

Reset History inside a bash script [duplicate]

I want to make a bash script that clears the history i.e. works similarly as the command history -c So I started with the following code:- #!/bin/bash history #displaying history history -c ...