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

learn more… | top users | synonyms (1)

0
votes
1answer
27 views

set -n not working in shell script when executing with source

this is the shell script.. #!/bin/bash set -n <<COMMENT1 tHIS IS A MULTILINE COMMENT MAN COMMENT1 <<COMMENT1 THII COMMENT1 : echo "this is ashok" echo "${LOGNAME}" when executing ...
0
votes
0answers
44 views

Ubuntu 14.04 /bin/bash Missing

I'm on a fresh install of Ubuntu 14.04 as of yesterday, and today I was setting up a samba mount, but when I closed my terminal and opened it back up, I only see the dollar sign "$", and up and down ...
1
vote
1answer
60 views

how to automatically add IP address to list of known host when ssh?

Situation Two systems. One which add IP address automatically to list of known host when doing ssh. Warning: Permanently added '192.168.158.XXX' (ECDSA) to the list of known hosts. One which ...
2
votes
3answers
74 views

Delete multiple lines from file when text is found

I've seen multiple answers to delete a single line with sed or grep, but I'm in need to search for a line, delete that one, and the 2 proceeding lines. For example, in the file ~/.profile I have lines ...
1
vote
1answer
73 views

How to deepfreeze Ubuntu like Windows deepfreeze? [duplicate]

We have many PC's with Ubuntu in one enterprise for pilot case (if it works and they are happy they will buy it permanently, but if not happy i lose) such as 300 to 400PC's. Now they want to remove ...
0
votes
3answers
52 views

Print a string a number of times [closed]

I have a variable numvar which contains a number. CODE something that reads number stored in numvar and then creates the same number of sTrapValue[with a number here that incrementally ...
0
votes
0answers
53 views

How to make GIF's at certain time from video and add text to it using ffmpeg

I have a one minute 3gp file from which i want to create a gif file. Condition for creating GIF file Create GIP between 21-40 seconds of one minute video Add text to the GIF Different fonts and ...
0
votes
3answers
83 views

Comparing two strings together

I have array called sev[w] where w ranges from 1 to 21. the array contains the following: CRITICAL INFORMATIONAL CRITICAL INFORMATIONAL INFORMATIONAL INFORMATIONAL CRITICAL CRITICAL ...
1
vote
1answer
41 views

Is there a way to simulate a bash shell inside the crontab file?

I noticed when I tried to use bash's 'date' inside a command, I could not, when I tried to pick up a file that varies by date.
2
votes
3answers
50 views

How to make a bash script execute when the battery on my laptop begins charging/discharging?

I have a conky setup that displays my battery level. The problem is, whenever I plug/unplug my laptop from the charger I need to run the conky-startup script to get it to display properly. I find this ...
0
votes
0answers
17 views

Xchat and cronjob?

I've submitted a thread in Ubuntu forums. Where I talked about if there's a way to automatically send a message after a certain amount of time. One guy replied and said to me that he has wrote an ...
1
vote
3answers
80 views

Bash: What to do when control-c won't kill a process, is there a better solution to the on/off button?

The full title of this question is: Bash: What to do when control-c won't kill a process, due to the fact that the bash script contains a loop which calls another process: Is there a better solution ...
1
vote
0answers
21 views

keep same inodes metadata with rsync or ignore metadata with du

I'm trying to synchronize two folders from a remote computer. I want to use rsync to send the folder, and du to check if the space used is identical on the remote computer. The problem is even with a ...
3
votes
1answer
868 views

What is the logical mistake in this code?

I have written some code for downloading favicons. It has a logical error which I am not able to see. #!/bin/bash ico="1"; if [[ $ico =~ ^-?[0-9]+$ ]]; then wget -P $HOME/Downloads/ ...
0
votes
2answers
54 views

How to deal with spaces and quotes in the command line

I have used this link for preventing programs use the Internet connection on Ubuntu/Linux. However I still can't complete the last step as shown: $ ni wine C:\Program Files (x86)\Foxit ...
-2
votes
2answers
67 views

Delete lines between 2 strings

I am to delete all stings from starting of file to a certain point using anything, sed, Grep, awk in shell INPUT sCSISmart20 TRAP-TYPE ENTERPRISE cyclone ...
0
votes
0answers
37 views

Shell script to retrieve MTR data

I made a script, to retrieve the data of a mtr to a specific IP, and log into graphite the average time response (ms) and the packet loss: But sometimes, the script fails, mtr report come like this: ...
2
votes
5answers
115 views

Condition that matches all occurrences of a word in a file ad does something

I am to do something like this for (( every occurrence of the word TRAP-TYPE in a file )) do desc="$(< inputfile awk '/DESCRIPTION/ {getline; gsub(/^\s*"/, ""); gsub(/"\s*$/, ""); print}')" ...
29
votes
7answers
3k views

How to access bash without a terminal emulator?

Say I've accidentally uninstalled every terminal emulator on my system: xterm, uxterm, gnome-terminal, guake, etc. Is there a way I can access bash without a terminal emulator? One possible way I can ...
-1
votes
2answers
35 views

How to copy an executing script from current folder to another by double click

How should we copy an executing script from one folder to the another? The script content is: #!/bin/sh zenity --forms --title="Add Friend" \ --text="Enter information about your friend." \ ...
-1
votes
2answers
118 views

Copying some parts of file

I am to copy "SNMP Agent is up" and "::=101" and count the number of variables present (example here there are 5) and put them in 3 Different variables. FROM FILE.TXT sCSISmart1 TRAP-TYPE ...
3
votes
5answers
236 views

sed remove last 2 numerals

I have the following. oid=.1.3.6.1.4.1.795.2.5.0.xxx (these 0.xxx represent any random numeral) I want to do the following echo $oid | sed (some commands to remove 0.xxx) and store the resulting ...
0
votes
1answer
33 views

2 Dimensional array Error in shell

#!/bin/bash i=$(awk '{x++} END {print x}' mibwithtraps) echo $i IFS="," while read f1 f2 f3 f4 do echo "hell :$f4" done < mibwithtraps This prints this: 7 hell :CRITICAL, hell ...
1
vote
2answers
31 views

New to script question: 'else' not expected in BASH script

Could someone help if possible. I am trying to resolve an issue I have in this script. I am getting 'else' not expected, but the logic seems to make sense. Scripting is all new to me, but I am ...
3
votes
1answer
193 views

How to check if two or more programs are installed using a bash script?

I want to check whether two or more programs are installed using a bash script: hash foo &> /dev/null if [ $? -eq 1 ]; then echo >&2 "foo not found." else echo "foo found" fi ...
0
votes
0answers
25 views

Execute jar file when user mount a loop block device linux

I successfully created and mounted a loop block device using these commands. dd if=/dev/zero of=my_fs bs=1024 count=30720 losetup /dev/loop0 my_fs mount -t ext3 /dev/loop0 ...
2
votes
3answers
106 views

search in subdirectories for all html files containing the tag <abbr>

I have a directory include many files of different extensions. What I want is to list all .html files only that contains the tag .
0
votes
2answers
100 views

Environment Variable seems to be set yet not working

I use Ubuntu 14.10 with bash shell. I downloaded a gradle distribution and moved it to a new directory. I want to permanently set a environment variable to point to the bin sub-directory of the ...
0
votes
0answers
17 views

Alternative for notepad++'s IndentByFold plug-in in gedit (auto-indent) [duplicate]

I have some bash script which I want to beautify/code format. In my windows system i have used notepad++'s IndentByFold plug-in to code format and beautify some php,html file etc and it worked fine. ...
0
votes
1answer
31 views

How to backup and reinsert .bashrc-like files with post-install script?

I have my proudly written .bashrc and .bash-aliases files. Sometimes, I edit them. More often, I reinstall the whole system. What is the best and simplest way to preserve content of files (for ...
10
votes
5answers
673 views

How do I prevent a folder inside of /tmp from being cleaned up?

This question is about Ubuntu 14.10 on my developer laptop. I've got a folder in /tmp that is used by an application to put temporary stuff in there. This application usually makes a temporary folder ...
3
votes
1answer
138 views

youtube-dl file download progress with zenity progress bar

How to add youtube-dl file download progress percentage to zenity progress bar sample code (just an example, not a working one) #!/bin/sh ( progress=$(youtube-dl --extract-audio --audio-quality 0 ...
0
votes
1answer
35 views

Bash script to log all recent apt-get installs and locations

Sorry if something like this already exists, but in my research I found no evidence that it did. what I want: a "monitor" type script that I can write, that I would "activate" prior to apt-get ...
0
votes
1answer
77 views

Hiding terminal when executing zenity bash script by double click

Is there a way to hide terminal when a bash script for zenity is executed eg: szAnswer=$(zenity --entry --text "where are you?" --entry-text "at home"); echo $szAnswer I want to hide the terminal ...
3
votes
2answers
23 views

Maintaining server-wide dot files in bash

Let's say I'm administering an Ubuntu setup with multiple users for my organization. We have a standard .bash_profile and .bashrc with aliases, prompt settings, PATH declarations, etc... that we want ...
1
vote
0answers
14 views

How to ponysay multiline messages?

When I am running phpunit I get a multiline response: $ ./vendor/bin/phpunit -c tests/phpunit_no_code_coverage.xml --filter=Ncl PHPUnit 4.1.6-6-g43914fa by Sebastian Bergmann. Configuration read ...
2
votes
2answers
31 views

Checking a floating point value within a range

Just wondering how can I check if a floating point value is within a certain range using "bc" and the conditional statements in bash. Thanks in advance For example,I want to find out if 17.2 is ...
0
votes
0answers
40 views

Java environment variable in Wine (32 bit prefix)

I need to run a Windows executable that requires Java 32 bit. Since Java 8 is still unstable in Wine, I installed a 32-bit Java (7u76) in a 32-bit WINEPREFIX. Now, when I run the Windows executable, ...
-1
votes
2answers
32 views

Sed script to print a variable based on user input

I want to write a sed script that reads user input, and if the variable matches a predefined string it should print welcome, otherwise it should print sorry. For example, if user inputs "Hello" the ...
2
votes
1answer
72 views

apt-get update fails in Ubuntu 14.04 due to GPG Error

I am currently on Ubuntu 14.04 (new to Ubuntu, migrated recently). 'apt-get install' works fine, and my connection is working fine as well. But when I run apt-get update, this is what happens 100% ...
-1
votes
4answers
64 views

=0 command not found bash

grep "::=BEGIN" -q < /home/erawson/bin/HP/adaptec.mib CHK= echo $? if ($CHK = "0") ; then echo "failed" else exit fi error is: /home/erawson/bin/try1: line 10: =: command not found
5
votes
2answers
486 views

What is the differences between &> and 2>&1

There are two forms of redirection the standard output and standard error into standard output. But which one is better? and why the &> is considered the perfect? I can't find what is the ...
2
votes
5answers
281 views

Use sed command to apply a condition to check if a pattern has been matched

I am searching for the string ::=BEGIN and I want to apply a condition to check if the word has been found. So, what I mean is something along these lines: if (sed command does find a match for ...
2
votes
2answers
29 views

Is it possible to define website variables for git?

I would like to be able to run something like: git clone mw/Math.git where mw equals: https://git.wikimedia.org/git/mediawiki/extensions, i.e., the MediaWiki extensions git repository. Instead of ...
1
vote
3answers
47 views

Rename directory using a variable

I have a directory that contains thousands of sub-directories. Structure like this: Dirs: 1 2 30 109 I want to rename all the directories by adding 10000 to their current name. E.g. Dirs: ...
-1
votes
1answer
22 views

Split a stream of characters in space-separated groups, on a per number of characters basis

I'd like to split the output of < /dev/urandom tr -dc 'A-Z0-9_' in space-separated groups, on a per number of characters basis and output everything to stdout. This is the output of < ...
1
vote
1answer
20 views

Nautilus script to compare hash values of two files

Sometimes I need to check if two files are identical. I attempted to make a bash script to achieve that but I can not make my head around it. I found below script on the net, I placed it in Nautilus ...
0
votes
0answers
18 views

Package bash-builtins: unable to run make sucessfully in examples/loadables

When I was wander through the Ubuntu 14.04 apt repository using apt-cache search ^bash, I found the bash-builtins package, and installed it. After installation, with dpkg -L bash-builtins, I found ...
52
votes
6answers
3k views

When using && and sudo on the first command, is the second command run as sudo too?

If I run a command. sudo some-command && some-other-command Is the second command being run with sudo previlege also?
1
vote
0answers
28 views

rsync multiple IP's using bash script?

I am trying to use rsync to synchronise remote files with local server. It works great but I want to do it on multiple remote servers to sync with on daily basis. sshpass -p "xyz" rsync -avz ...