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

learn more… | top users | synonyms (1)

2
votes
1answer
508 views

pdsh works well standalone, but doesn't work in script

I am trying to install hadoop via script on my small cluster [introduced in the book: Apache Hadoop Yarn]. I have set up ssh connect without password, and pdsh&pdcp are all fine if I use it alone. ...
1
vote
1answer
85 views

Strang echo behavior

To boil it down: The following command in bash echo $(ssh -t pi@doctor "sudo stat -c \"%U\" /var/www/candy/example/index.html")101 Gives the this result Connection to doctor closed. 101-data ...
-1
votes
3answers
92 views

Create a script that takes a word as an argument from the user

echo "Enter your string" read str; How can I put in a check to make sure the user passed in a word, displaying a usage statement if a word was not passed as an argument.
0
votes
2answers
74 views

if stament in shell script

How write in if [ -z $str1 && -z $str2 ], "&&" doesn't work, if write [ -z $str1 ] this is work. I want to once two string #!/bin/bash echo "Enter first string" read str1 echo ...
1
vote
1answer
139 views

Use gnome-terminal as the Fzf launcher in GVim

How can you use gnome-terminal as the launcher of fzf in GVim instead of the default xterm: https://github.com/junegunn/fzf let g:fzf_launcher = 'xterm -e bash -ic %s' I want to use gnome-terminal ...
1
vote
1answer
373 views

How to add header file by script? [duplicate]

I want to add a sentence to header of a file using bash script, I tried echo "#define Block $i">>mypro.cpp but it add '#define Block $i' to it's end. Thanks in advance
3
votes
2answers
179 views

How to print the first three digits after the decimal point of a floating number?

I am new to BASH and learnt that both printf and echo write to the standard output. But, I came through the following example which reads an expression from input and computes the result to accuracy ...
1
vote
4answers
4k views

How Can I Run an Shell Script With .desktop Config File?

I am trying to run a shell script with a .desktop file but it doesn't seem to work, producing an error of There was an error launching the application at each attempt. I have the sh and .desktop files ...
1
vote
1answer
728 views

Deleting all files with filenames matching a pattern and size below a certain limit

I need to delete all files with a .avi expansion and whose size is below 100MB. I have a large collection of video files and I need to delete the short ones to free up some space. How do I accomplish ...
1
vote
1answer
651 views

source not reading symlink correctly?

My .bashrc file is a symlink to ~/Scripts/rc/bashrc. This works well for me, and has been for years. However, as of today, this is what I am seeing: bash-4.3$ source .bashrc bash: source: .bashrc: ...
7
votes
4answers
2k views

How can I delete a file if it starts with <html> in bash?

I need a bash command to delete the entire file if the file itself begins with <html>. I'm not sure the best way to go about this... Context: I download a series of files via curl requests. ...
0
votes
1answer
377 views

How to automatically mute on headphones disconnect? Or how to tap bash script to system event listener?

My life would be easier if Ubuntu was muting the sound each time I disconnect the headphones, since every time surrounding is different (example day / night), but the same output volume. I may ...
1
vote
2answers
3k views

bash: using “cut -c” on the strings with spaces like “ ?.?”

i just want to get the third char from watingForHDD. Any idea how to do this? (my idea was to log some data about the used system capacity etc...) #!/bin/bash x="`top -d 1 -n 1`" echo "$x" ...
0
votes
2answers
165 views

How to write a script which automatically presses `Fn + F3` button on my keyboard

I am struggling with screen brightness reset issues . It resets to 100% on every reboot. I have tried searching for solutions but none of them worked[including xbacklight ]. Since I can change ...
3
votes
2answers
1k views

For loop syntax bash script

Is there a way we can implement some thing like this in bash script ? pureips="10.3.1.111 10.3.1.112 10.3.1.114"; pureservers="a b c"; for ip,server in $pureips,$pureservers; do echo "$server | ...
4
votes
1answer
153 views

How to make the terminal autocomplete based on previously entered commands? [duplicate]

It's normal when using terminals that pressing up and down cycles through previous commands entered chronologically. I learned from a site how to add to that behaviour by autocompleting what I'm ...
2
votes
3answers
168 views

SED \n and \ into nothing

The people on this forum have been a tremendous help! Thank you so much! Here is my string ...
0
votes
1answer
1k views

Help decoding Base64 using base64 -d

**** This post links to Windows-Based malware executables!!! DO NOT EXECUTE DECODED SAMPLE **** I hope I can post this here without having it pulled down. I have 2 seemingly identical base64 ...
2
votes
1answer
236 views

how to make scripts which will run on installation of apt package

I have created a bash script which will store some data into a mysql database. Then I have created deb file with that script and made it available for installation by creating local apt repository. ...
2
votes
2answers
866 views

Displaying TTY name in Terminal name

I am wanting to know how I can display the TTY a terminal is currently using in the window name of the Terminal. I don't see any options in Terminal Preferences to display such thing on the Terminal ...
0
votes
1answer
82 views

Locate two variable strings and write one as a file [closed]

I have a text document that contains 2 lines of information. Line 1 contains a filename, and line 2 contains an reference ID. The document contains additional strings other than the desired ...
2
votes
2answers
9k views

Cannot run bash script from crontab when it works from command line bash

I have a strange problem of being to able to run a bash script from commandline but not from the crontab entry for root. I am running Ubuntu 12.04. * * * * 1-5 root ...
0
votes
1answer
726 views

How do I autorun terminal commands at startup in Lubuntu 14.04 LiveCD?

I'm doing some remastering of Lubuntu 14.04 LiveCD, and need to run the following command at startup: /sbin/ifconfig eth0 10.10.10.1 netmask 255.255.0.0 First, I tried modifying rc.local as ...
1
vote
1answer
1k views

Add custom script to PATH

I know there are quite some answers about that, but still could not make my way around it. I read all this and tried to follow the example under System-wide environment variables (for my case of ...
1
vote
1answer
191 views

Starting program via terminal and putting it immidiatly in the bg / bashrc

So i am trying to start a Programm by using the terminal but i also dont want it to be locked to the said terminal. i added an alias inside the bashrc for easy startup: alias tksuite='sudo sh ...
8
votes
2answers
1k views

Ending tail -f after print n lines

I have the following. A Java process writing logs on file A shell script starting the Java process. I need to read the log file after start Java process to check correct starting. I have try with ...
0
votes
1answer
347 views

Running Questasim in Ubuntu

I tried to install Questasim 10.2 in Ubuntu 14.4 32 bit.Everything was ok.But when I tried to run the Questasim it is showing an error bash: ./vsim: cannot execute binary file: Exec format error ...
13
votes
3answers
795 views

Deleting input back to the last forward slash

I will very often be flitting between several files on a server. I will run the following example commands in sequence: nano /web/site/path/to/file /web/site/script.py nano ...
3
votes
3answers
3k views

executing certain commands do absolutely nothing

I have installed 3 new packages recently through NPM and none of them are executing. I ran sudo npm install -g ionic and the installation looked like normal. Then I can run which ionic and I get ...
12
votes
0answers
894 views

What is the 'command' command and what is it used for? [duplicate]

I was trying to learn new terminal commands. Then I tried to write command to test what happens. Strangely, looks like it's a valid command, but what does it do? It didn't return anything.
2
votes
1answer
3k views

curl .gz file and pipe it for decompression

I am trying to download some .gz files (N.B. not .tar.gz ones) from given URLs and decompress them to overwrite existing files, if any. For each individual download, I tried the following: curl -O ...
0
votes
1answer
318 views

How do I detect if the current session is an SSH session via bash?

I would like to detect whether the current user session is from an SSH connection - that is, whether the user is physically sitting at the computer that hosts the current terminal or whether he is ...
4
votes
1answer
50 views

Why doesn't yes fill up the buffer?

Say I do something like yes | apt-get install foo. I know that yes will non-stop print a bunch of y\n's to stdout. But apt-get can only process a few of those. Why doesn't yes fill up the buffer? Does ...
1
vote
2answers
641 views

How to move files based on first word in file name?

In a folder, I have thousand of files, such as: cat eats mouse.jpg cat chases mouse.jpg gorilla eats banana.jpg gorilla is sleeping.jpg elephant is huge.jpg elephant has trunk.jpg (and so on...) I ...
7
votes
2answers
6k views

Difference between echo -e “<string>” and echo $“<string>”

What is the defference between using echo -e "Hello\nWorld" and echo $"Hello\nWorld" don't they both output: Hello World
1
vote
2answers
393 views

gibberish command not found on bash terminal startup

I have run across an issue that I just cannot seem to figure out. When I start my terminal in ubuntu (14.04) I get the message sdfsdfsdi: command not found As you can see it just looks like ...
0
votes
2answers
232 views

Install Sw in /usr/local but bash terminal doesn't see programs

I'm a newbie Ubuntu 14.04 User. I need Netbeans to develop software so I decided to install the 8.0.1 version. Since the pkg installer doesn't have the latest version, I downloaded the .sh file from ...
4
votes
2answers
4k views

Script doesn't work when it is run using '#!/bin/sh'

I have a script that use shebang : #!/bin/sh, but when I run it in my Ubuntu 14.04 terminal, it doesn't work and it says that some lines has unexpected operator. My friend in another computer could ...
1
vote
2answers
440 views

How to run commands from a bash file the way they run from terminal?

Sorry for my probably very naive question. What I mean is: how to create an executable script/bash file that would run more complex commands, commands which must normally be put in a terminal? ...
0
votes
1answer
152 views

Where does the output of a script that was run at startup go? [duplicate]

I have a script which is run at startup from rc.local, I don't redirect the output anywhere. When I first wrote it, I ran it in a shell, it worked as I expected and continually poured characters out ...
0
votes
2answers
352 views

updating my path not working

I want to add a script directory in my home directory (for something different then just adding to bin). I keep getting "No such file or directory" after updating. Now I noticed that in the GUI file ...
3
votes
1answer
222 views

jumping cursor when using python interpreter in terminal

When I am typing in a long command while using the python interpreter in terminal, the cursor will suddenly jump all the way back to the beginning of the line that was just typed and start ...
2
votes
1answer
508 views

Move Files To Directories Based on File Name

I have files that download to one directory (/media/Downloads/Complete/Movies) but need a bash script that moves them to the destination directory based on file name (/media/Movies_A & ...
-1
votes
2answers
557 views

How to add running program icon to left-side bar? [duplicate]

As in question, how can we assign an icon here? Regards
0
votes
1answer
175 views

unable to execute .sh scripts - only on one pc

This is an unusual problem for me - what would cause one pc to suddenly be unable to execute an install.sh script, yet two other pcs with the same OS have no problem doing so? I get various errors ...
0
votes
1answer
903 views

Run commands on system shutdown/reboot/logout [duplicate]

I would like to run certain aliases and simple commands when system shuts down or reboots or when I simply log out of system. This would help a lot as I usually forget about shutting down vagrant ( ...
7
votes
2answers
3k views

uniq command not working properly?

So I'm checking the md5 hash of my files with this as my output: 657cf4512a77bf47c39a0482be8e41e0 ./dupes2.txt 657cf4512a77bf47c39a0482be8e41e0 ./dupes.txt 8d60a927ce0f411ec94ac26a4785f749 ...
0
votes
1answer
324 views

autogen.sh can't find “ fontconfig” package

ran autogen.sh and get the error "package 'fontconfig' not found". I also get the suggestion to adjust the 'PKG_CONFIG_PATH' enviroment variable and/or variables "FONTCONFIG_CFLAGS" and ...
0
votes
1answer
787 views

rc.local not called when starting the system

Here is the full rc.local #!/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 # value on ...
2
votes
1answer
4k views

Terminal Command to Zoom

I've been looking for this for a while, and I can't find it anywhere. I need to be able to zoom (equivalent of ctrl + shift + '+') via the terminal. I've tried xdotool, but do not know how to get it ...