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

learn more… | top users | synonyms (1)

0
votes
0answers
14 views

Where do I put Ubuntu server post install script files

Using the kickstart app, I can create a (I presume) bash script to run after the install finished in a chroot environment. If I have pre-writtren scripts and config files to copy over, can I include ...
-5
votes
1answer
127 views

code matrix to letter [closed]

a txt file I have looks like this 1 3 6 7 9 11 000000 100001 000101 110100 000100 the recoded version should be UUUUUUUUUUU YUUUUUUUUUY UUUUUUYUUUY YUYUUUYUUUU UUUUUUYUUUU for this the first ...
0
votes
0answers
14 views

Install script as service running under speciffied user

I would like to install services into init.d folder in most standard way. Suppose I have script which should be run under specific user and starts the service (tomcat8 good example) ...
0
votes
1answer
33 views

Click every link on multiple webpages

In our project we have pages like http://123.4.5.6/3/4; inside there are a few pages. I need to access the URLs and to click on every link within them to download some files (in an automated way). ...
0
votes
0answers
12 views

How to run a script between login(entering password) and being logged on(showing desktop)?

Is there a way to execute a script when a specific user logs in; after they enter their password but before they are actually presented with the desktop? The script in question may lock the computer ...
23
votes
5answers
1k views

Why bash is the default shell in most OS?

Why is bash the default shell in most os ubuntu, fedora, mac ...etc and why is it that a lot of advanced users mostly use zsh and if it is that good why is it not the default? ps I use both I don't ...
1
vote
1answer
88 views

How to remove http headers from curl response?

How to remove HTTP headers from curl response in bash? I am getting this header values on every response how can I remove them? or not receive them? HTTP/1.1 200 OK Vary: Accept-Encoding ...
0
votes
2answers
41 views

apt-get exits bash script after installing packages

I have read the answers in this post but it doesn't seem to work for my problem. I am executing a bash script via stdin from wget: wget -O - http://serverip/subfolder/script | sudo bash I've tried ...
0
votes
1answer
25 views

Using wget with Streamcloud and pages where you have to wait

I'm new to bash scripting and as I heard of "wget" I decided to write a script to download just the .mp4 file from a streamcloud (or whatever) link. I use it normally like: wget -q -O - ...
2
votes
5answers
64 views

Shell script & “nvidia-smi” - needs right command/flag!

I've got a problem regarding a shell-script and the "nvidia-smi" command! I've made a script that as protection against CPU overheating on my Ubuntu Server 14.04.2. The scripts works nicely but I ...
2
votes
2answers
55 views

How often can I type exit without logging out?

I logged in to Debian 7 via SSH, not as root. When writing sudo all the time became too much overhead, I did sudo su. Since the Debian default shell (dash ?) does not support the Tab key to complete ...
-1
votes
1answer
13 views

Colorize landscape-sysinfo

Any ideas where the base scripts for landscape-sysinfo are? I would like to add some custom colors. For example, when RAM is between 0 and 50%, color the percentage green, 50-70% color yellow, etc. I ...
0
votes
0answers
46 views

How to change MAC address “permanently”?

I am using Kubuntu 15.04. I was using macchanger eth0 -rto change my mac address. But there were two problems: Every time I disconnect and again connect to the network, the mac changes to the ...
0
votes
3answers
58 views

logout current user from script

I would like to create a script that: run some commands execute sudo su - [some other username] after I exit from [some other username] -> logout Example: test.sh echo "test script" sudo su ...
0
votes
1answer
54 views

Data manipulation of libreoffice calc (spreadsheet) using terminal commands

Is it possible to manipulate data in LibreOffice calc (spreadsheet) using terminal commands. I have a spread sheet with loads of data in csv format and i want to do data manuplation from terminal ...
0
votes
1answer
24 views

How to pass a command with variables to at?

So, I'm making a bash script that's supposed to accept times and an extension from the user (through zenity) and schedule a call with sipcmd at the given time: extension=$(zenity --entry ...
1
vote
3answers
83 views

retain white spaces in fields when using awk

I am using nawk on a pipe delimited file to print fields as index and key where some of the fields contain white space, when there is no white space everything works normal, but in case of white ...
2
votes
1answer
29 views

How to append and sort the ouput of a command to a file?

I am trying to extract http usernames and passwords from a pcap file using tshark and then saving them in a text file. Later, if I want to add some more tuples to that text file, it should not only ...
3
votes
3answers
52 views

bash: populating array with elements containing spaces and special characters

I want to be able to populate elements of an an array with arbitrary strings, i.e. strings that may contain \ and spaces for instance. I wrote this : #!/bin/bash function populate_array () { if ...
1
vote
1answer
26 views

What does bash -i -c do?

I would like to run ROS using PyCharm, but I have to modify the desktop file jetbrains-pycharm-ce.desktop from: Exec="/opt/pycharm-community-4.0.4/bin/pycharm.sh" %f to: Exec=bash -i -c ...
1
vote
2answers
52 views

Does wget or any other http file downloader on Ubuntu support wild cards?

I would like to be able to write a bash script to automatically update my MediaWiki extensions and I think I will use this website https://extdist.wmflabs.org/dist/extensions/ to do so. But as you can ...
0
votes
1answer
18 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
28 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
41 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
54 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
47 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
49 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
30 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
76 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
30 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
38 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
15 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
69 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
18 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
865 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
43 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
60 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
24 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
107 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}')" ...
28
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
33 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
114 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
198 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
32 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
29 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
149 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
18 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
81 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
67 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. ...