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

learn more… | top users | synonyms (1)

5
votes
1answer
431 views

Difference between cd / and cd //?

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 ...
0
votes
0answers
12 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 ...
0
votes
4answers
30 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
1answer
38 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 ...
3
votes
2answers
152 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 ...
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. ...
1
vote
0answers
35 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 ...
10
votes
5answers
821 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
1answer
25 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
2answers
50 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
1answer
18 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
40 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.
-1
votes
1answer
34 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 ...
1
vote
3answers
62 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 ...
0
votes
2answers
48 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 ...
0
votes
4answers
52 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: ...
7
votes
5answers
580 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 ...
1
vote
1answer
24 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
0answers
8 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" > ...
0
votes
1answer
44 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
2answers
46 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 ...
2
votes
2answers
24 views

Error using “cp” to copy files to an external disk

I have a 2TB external HDD formatted with exFat that I use to share very large files (>10GB) among Ubuntu, Windows 7 and MacOS. I am trying to copy the whole content of a directory using sudo cp -r . ...
0
votes
1answer
16 views

Path to shell script in aliases with ./

I'm trying to make an alias for my shell script which is saved in ~/Dokumente/music.sh Therefore, I added following line to ~/.bash_aliases: alias music='.//home/robin/Dokumente/music.sh' After ...
0
votes
0answers
30 views

Install SystemC in Ubuntu 14.04 [on hold]

Q : I want to install SystemC 2.3.1 in my Ubuntu 14.04. During the installation, when I enter make command, the below error occurs. (gcc 4.8 is installed.) What is the problem? /bin/bash: -c: line ...
1
vote
2answers
43 views

exports in .bashrc not working

I have a program .path.py which prints an export command for PATH. In my .bashrc I have an entry at the top $(python $HOME/.prefix/.path.py) except that when I login over ssh, or even run source ...
2
votes
1answer
37 views

fsl.sh cannot be sourced

I need to install FSL and Freesurfer as part of running Connectome Mapper. Freesurfer required changing the shell to tcsh in order to configure its folders. Now for FSL, I have to add to .profile the ...
1
vote
2answers
39 views

How to run .sh through terminal without using Nautilus Ubuntu 14.04 [duplicate]

I have an .sh file that looks like #!bin/bash exec /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/ java java -jar /home/me/myfolder/my.jar I've made this file executable and it works fine when in the ...
1
vote
2answers
26 views

How to write a script with nautilus actions?

I want to use nautilus actions with my own script which I have usually started successfully with open-terminal and pasting the command (s. below) directly in the terminal. for file in *.mp4; do mkdir ...
3
votes
3answers
77 views

How to differentiate command from the output using color

I have to differentiate command from the output using color like this $ cat file-name (this should be in some color say like red) some test in file OUTPUT (this output should be in some other color ...
3
votes
2answers
31 views

I think I deleted bash!

I am attempting to make a PXE server that will boot Ubuntu (live cd) 14.04. I was trying to copy the bash file from /bin/bash to /var/lib/tftpboot/Ubuntu/bin/bash I must have used the ...
0
votes
2answers
32 views

How to properly detach a command?

I have this little script I use to launch a root Nautilus window (yeah, dangerous, but sometimes necessary): #!/bin/bash gksudo --description "Launch a root Nautilus" -- sh -c "xdg-open / &" ...
1
vote
1answer
44 views

Undo apt-get remove --purge

I wanted a fresh install of Python and ran sudo apt-get remove --purge python. Apparently it has killed almost everything I had installed in my system. Looking at the history.log I guess I could ...
1
vote
3answers
34 views

Cannot find location of permanent aliases.

A couple of months ago, I made a few permanent aliases for my bash shell on Ubuntu 14.04. They are actively making my life easier, and I would like to add a couple more to the list, but I cannot find ...
3
votes
1answer
87 views

How to send an email using command line?

Here's what I have: cat UserReport.txt | mail -s "TestSubject" "nospam@gmail.com" It's a small file, much smaller than a picture so it should send almost instantly. Though I receive nothing. I ...
0
votes
1answer
33 views

How to run bootinfoscript from the GParted liveCD?

How to run bootinfoscript from the GParted live CD? Windows 7 on internal hard drive, and Linux on an external USB SSD drive (Linux not loaded).
11
votes
6answers
809 views

How to make the argument as optional in bash function?

In have this function with 9 arguments: SUM() { echo "The sum is $(($1+$2+$3+$4+$5+$6+$7+$8+$9))" } And I want to make the second arguments to the next(3..9) become a optional arguments. When ...
0
votes
0answers
13 views

bash script transition to Qt Ubuntu SDK [duplicate]

I've a script in bash that I would like to write in Ubuntu SDK QtEditor: sudo su echo $PASSWD sudo cp -rf ./Livewave-master ~/tmp/Livewave cd ~/Livewave sudo chmod +x update_XPTO.sh echo $PASSWD ...
-1
votes
1answer
36 views

Sourcing a file [closed]

I am using ROS (Robot Operating System www.ros.org). I have to source .sh file every time. What it means ? source /opt/ros//setup.bash or have to enter this line in .bashrc file Why we need this ?
3
votes
4answers
79 views

making a bash script executable programatically

I need to create a bash script to create and mount a drive. So, two simple commands. Both "work" when entered at the command line. The script is created and executed every time a normal user logs in, ...
3
votes
3answers
231 views

Special variables in bash

I know these are few special variable used by bash. But I am not able to understand it. Can anyone explain me what are these variable and how to use it? $* $@ $#
0
votes
0answers
25 views

wait for job in bash script

find /var/www/ -ipath */logs/access.log.gz -execdir mv "{}" "old/`date +\%G-\%m-\%d`-access.log.gz" \; wait service nginx reload wait python /var/www/default/piwik/misc/log-analytics/import_logs.py ...
1
vote
1answer
37 views

Shell Script Problem

I decided to make a shell script for basic nmap scanning so I did it like this : #!/bin/bash sudo apt-get install nmap printf "enter the name of site to do basic scan on >>>" read NAME ...
1
vote
3answers
18 views

Wildcard: return source path

I'm trying to rename every access.log.gz file (note: exact filename, not "beginning with" or "containing") found in /home/*/logs to date-access.log.gz in the same folder. for file in ...
0
votes
2answers
47 views

Bash error on opening the terminal

Whenever I open terminal in Ubuntu I get the following bash and I don't know how to solve it. I need a solution as soon as possible: bash: ...
0
votes
1answer
45 views

“Syntax error: Unterminated quoted string”

I am trying to use a backup script that will backup my sql database and website files. I am running Ubuntu 12.04 32 bit version and zPanel. Here is what my DB structure is along with which DB I want ...
1
vote
1answer
66 views

Bash script for multiple tabs program running

I have the following bash script code to open multiple session of a python script with different input argument in different terminal tabs. #!/bin/bash cd /home/me/experiment tab=" ...
0
votes
0answers
23 views

Permission denied after compiling a fortran program [closed]

After I compile a fortran code, it gives a non-executable program (only the mode rw, not x). When I run it says: bash ./program PERMISSION DENIED If I change mode chmod u+x program, then it will ...
2
votes
0answers
66 views

Shell command not asking for password inside while loop [closed]

I am trying to run .sh file to put certificate via keytool command in every jre/lib/security/cacert file described in ~/.java/deployment/deployment.properties file. #!/bin/bash ...
-1
votes
0answers
11 views

i forgot Admin pass on my Think Pad and Nothing is Helping me! [duplicate]

I am in the GNU GRUB now. I see 4 options Ubuntu, Advanced options for Ubuntu, Memory test, memory test with a bunch of numbers after it. I found out how to finally get in to recovery mode after ...
2
votes
1answer
28 views

Bash script that opens multiple netcat instances and exits them

I am trying to create a script that opens up multiple gnome-terminals and opens a netcat connection. After a couple seconds I would like the terminals to close. I am at a loss and I believe it can't ...