Tagged Questions

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

learn more… | top users | synonyms (1)

-1
votes
3answers
40 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
25 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 "Enter ...
0
votes
1answer
12 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 ...
0
votes
0answers
39 views

Script problem at boot ubuntu

I have an application in C++ which show a ipcamera video when I send it a value by ethernet. I want that the application start at boot in automatic way. This is my script: #!/bin/sh ...
0
votes
0answers
11 views

Scheduled Cron Back up from EC2 to S3

I have created a script for scheduling sql back ups and store in Amazon S3. Below is the script that I used for taking backups. DATABASES="testdb" testdb_USER=root testdb_PW=root ...
0
votes
1answer
27 views

Script problem Ubuntu

I am working under ubuntu 14.0.4, I have an application which I did in C++. This program only receives ethernet values, and show up an Ipcamera video which depends of the receives value. I am using ...
0
votes
0answers
23 views

kowing a specific user logged in 1 min

echo “ enter the login name of the user “ read name period=0 until who| grep –w”$name 2> /dev/null /* search for the user error are send to special file */ do sleep 60 period=`expr ...
1
vote
1answer
18 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
46 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
55 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
87 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
70 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: ...
6
votes
3answers
1k 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
21 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
55 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
54 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 ...
-1
votes
1answer
40 views

bash: ./configure: No such file or directory [closed]

I am real noob in ubuntu. I am currently working for my university project where I am supposed to install "ns miracle". It has a prerequisite, "ns allinone 2.xx", which I installed successfully. But ...
3
votes
2answers
81 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 | ...
3
votes
1answer
44 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
39 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
0answers
25 views

Error in export command in ~/.profile

I have this line in ~/.profile: export PATH=/sbin:/usr/sbin:${PATH} and it is causing this in ~/.xsession-errors: init: gnome-session (Unity) main process (1851) terminated with status 1 And ...
0
votes
1answer
29 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 ...
1
vote
1answer
28 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. ...
1
vote
2answers
33 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
63 views

Locate two variable strings and write one as a file

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 ...
1
vote
2answers
67 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
0answers
27 views

zip warning: No such file or directory

I have a backup bash script for my Dovecot emails like this sudo zip -y -r -q ~/backup.zip /var/vmail/* -r is for recursive, -q is quiet (since man said that's useful for bash scripts), -y is to ...
0
votes
1answer
56 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 ...
0
votes
1answer
53 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
47 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 ...
7
votes
2answers
630 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
10 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 ...
11
votes
2answers
315 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 ...
0
votes
1answer
32 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
3answers
876 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.
0
votes
1answer
31 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
0answers
19 views

When running a shell script using sudo I am getting no tty present and no askpass program specified

I am trying to build a project using jenkins. The project is based on node. I wrote a shell script that has only npm install command. I am running the shell script from jenkins as sh ...
0
votes
1answer
12 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 ...
3
votes
1answer
24 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 ...
0
votes
0answers
31 views

How to set the path to xstream in Ubuntu 14.04

I am using Ubuntu 14.04, and installed my version of jdk using sudo apt-get install openjdk-7-jdk Now I installed xstream 1.4.7, but whenever I compile any java files using the package, I get an ...
1
vote
2answers
75 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 ...
4
votes
2answers
71 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
52 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
47 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 ...
2
votes
2answers
218 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
64 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
20 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
36 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 ...
2
votes
1answer
53 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
40 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 & ...