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

learn more… | top users | synonyms (1)

1
vote
1answer
36 views

bash - using lftp to mirror specific files from remote folder

I want to mirror files from a remote directory via ftp. The following code works: lftp -c 'open ipaddress; user myusername mypassword; mirror -e /files/ /home/user/files/retrieve/; quit' However, ...
2
votes
1answer
49 views

cannot exec 'anything' : no such file or directory screen

I’m running some call of duty game servers with screen. I have a start.sh: #!/bin/bash user=cabe game=cod verision=cod1.5 server=xxx.xx.xxx:28970 mod= ip=xxx.xx.xxx port=28970 punkbuster=1 ...
1
vote
0answers
27 views

How do I run as bash script from a WebApp?

I currently am developing a custom Ubuntu dist. that runs a dedicated Kiosk app upon boot. I would like an easy method to shutdown from inside the Kiosk app, but I am currently at a standstill at what ...
1
vote
1answer
73 views

Run script in Terminal via context menu (Open with Terminal)?

this question is simple about "Open/Run in Terminal".... Looks Ubunutu doesn't support bash/shell-scripts the way we know from KDE and any other OS: I tried the obvious: Right click in file ...
0
votes
1answer
24 views

Script is not pausing until I type soff

The script is automatically calling the signoff script instead of pausing until I type "soff"? Also a user should not be able to start this script "signon" again while it is running. Below is what I ...
3
votes
3answers
96 views

Can I call a .cpp program in Bash?

I am new in Bash programming. I want to call my C++ program in Bash file. My program is myProg.cpp: #include<iostream> using namespace std; int main() { cout<<"Salam! ...
1
vote
2answers
56 views

Is there a command to round decimal numbers in txt files?

I saw this post, but I was wondering if there is a simpler command to round decimal numbers. I have a file with milions of numbers: 0.1 1.2 3.8 I want to round them to integer 0 1 4 Is there a ...
1
vote
1answer
23 views

How to print an octal value's corresponding UTF-8 character in bash?

I expected printf %s '\<octal_character_value>' to do the trick, but it doesn't: printf %s '\101' Outputs: \101
0
votes
0answers
26 views

copy an entire vm to dvd/cd disc?

I am writing a series of scripts on ubuntu for process control. I have needed to install several packages such as gawk and stress. I am doing this for a university project and will need to submit it ...
0
votes
1answer
40 views

Error when adding torrents to deluge with python: User does not exists

I am trying to write a python script to download my tv shows automatically as soon as they become available. I got the basics done. But i cant get to add torrent to deluge via deluge-console. The ...
0
votes
2answers
145 views

Open a file at a certain position and read one byte in bash

Since two persons already voted to close this post, I'll try to make the question as clear as possible. A file on a physical device is represented as a binary sequence. That being said, what I need to ...
3
votes
1answer
85 views

What are the differences between executing shell scripts using “source file.sh”, “./file.sh”, “sh file.sh”, “. ./file.sh”?

Have a look at the code: #!/bin/bash read -p "Eneter 1 for UID and 2 for LOGNAME" choice if [ $choice -eq 1 ] then read -p "Enter UID: " uid logname=`cat /etc/passwd | grep $uid | ...
0
votes
3answers
98 views

Linux equivalent for «cmd /C start “Title” “C:\Folder\file.bat”» [duplicate]

I have a Java program that runs a batch file on Windows with Runtime.getRuntime().exec() using the following command: cmd /C start "Title" "C:\Folder\file.bat" The Java program ends quickly since ...
1
vote
1answer
23 views

Bash script behaves fuzzily

I'm using this bash script to check if the content of two paths install and install1 passed as arguments is the same: #!/bin/sh du -a $1 | grep -Po "[0-9]+\t$1/\K.*" | sort -n > list.txt du -a $2 ...
1
vote
1answer
35 views

Check if a screen is active and then display countdown

#!/bin/bash DATE=$(date +"%m-%d-%Y") Backup_from="/home/mc/server/prison/" Backup_to="/home/mc/backups/PRISON-$DATE.tar" echo "Starting backup of $Backup_from to $Backup_to" screen -dmS backup tar ...
1
vote
1answer
44 views

Custom environment with gnome-terminal

I tried to put this into the startup applications: gnome-terminal --working-directory /media/Data/work/ -e '. .env/bin/activate' where .env/bin/activate represents my virtualenv. For some reason, ...
11
votes
7answers
976 views

How to display the paths in $PATH separately

I cannot figure out how to list the various paths in $PATH separately in so that they look like this: /bin /usr/bin /usr/local/bin etc. Does anyone know the correct variable for this?
0
votes
2answers
110 views

Print second vowel in word in red color

How do I print the second vowel in a word in red or blue color. Let say I execute my script called "script1" which reads a text file. My script should be able to print the second vowel in every word ...
1
vote
1answer
26 views

Using variables as paraments for commands in a bash script

I currently have a bash script which I can simply double click to remote desktop into my institution: #!/bin/bash xfreerdp -f -u myusername -d campus -p mypassword --ignore-certificate website.com ...
6
votes
2answers
159 views

How to use zenity file selection

I am new to zenity and I am trying to make a simple script for loading a file using zenity --file-selection and the wc command to get the word count of that file. I have successfully made a form which ...
-1
votes
1answer
57 views

Display specific characters in specific time from a text file

How can I display a specific number of words or characters in a given time using a loop. Lets say I want to display 120 words in one minute. Here is the loop i have tried: FS=$'\n' for j in `cat ...
0
votes
1answer
55 views

awk print output redirection

I am writing a bash script, and in that bash script I have a line similar to this: awk '/TextToBeMatched/ { print; print "TextToInsert"; next }1' "/Path/to/specified/file.extension" And currently ...
4
votes
2answers
219 views

Print only one line at a time from text file

how can I print or display only word from a text file at a time. When I run my script it should only display each word from the text file one by one, but only display that word. This is what I have ...
0
votes
1answer
18 views

Templates directory in Ubuntu: can I use this feature with gedit in bash shell?

Saw this question: What is the "Templates" folder in the home directory for? But I wanted to know whether I can use this feature with gedit in bash shell? If yes How? If no is there any ...
0
votes
1answer
45 views

Bash script in terminal on boot

Is there any way to run a .sh script in a terminal window on boot? My computer boots slowly and I want to be able to press the button and leave to save a lot of time. This script is a looping ...
0
votes
3answers
51 views

Substitute specific char sequence inside filenames

A friend of mine grouped tons of files in this way on windows After I made him switch to Ubuntu, files are no more ordered based on the number of exclamation marks in front, so I would like to know ...
3
votes
4answers
70 views

How can I divide output with delimiter?

I would like to change: e·ver·y·bo·dy to: e·ver·y·bo·dy e·ver·y·bo· e·ver·y· e·ver· e· A for loop will be greatly preferred.
2
votes
2answers
80 views

What setting controls this feature in my .dialogrc file?

I'm writing a bash script for personal use that uses dialog. My script is: #!/bin/bash DIALOG=${DIALOG=dialog} $DIALOG --title "Title" ...
1
vote
1answer
28 views

How to write a bash completion to complete director names starting at ~/

Imagine I have a bash script called myscript that will only echo it's first argument, which will be a directory name. Example of usage: myscript proj1 Where proj1 is a directory for example located at ...
0
votes
2answers
60 views

How to Keep Text Consistent in A Shell Script

Good Day! I am creating a Shell Script so I can then use it to do X (Won't tell) This is my Current Script clear echo Ahmad A Kazi echo IDNO: BD_3456 echo echo Data Clear Program echo c 2015 Ahmad ...
1
vote
1answer
43 views

How can I print a variable to a file?

How can I print the contents of a variable into a text file? For example, I have the following script: #!/bin/bash #My Bash echo "saisir votre nom" read $name I would like to print the contents of ...
2
votes
1answer
164 views

bash: /home/…/program: cannot execute binary file

I've got a problem with simple program. When I try to run it double clicking it. Also when I try to run it by writing its path in the termilal and it says bash: ...
1
vote
1answer
36 views

How to move all subdirectories to current directory?

I'm new to shell script programming. Suppose we have a file hierarchy like this: /A/B/C/D /A/B/E/F/G /A/H/I /A/H/J/K Note that here we not only have /A/B/.., but also /A/H/.... All letters are ...
1
vote
4answers
58 views

Bash - IF and && syntax?

I could use a little help with my IF and && statement. It's not working and nothing I'm trying is working either. Maybe someone can see the issue: if [[ $thisvariable="yes" && grep ...
3
votes
2answers
313 views

copy to clipboard current path from console with no mouse [duplicate]

I'm wondering if it possible to copy to clipboard output of pwd command. I often need to copy some path and I have to select it with mouse, do several clicks and that is annoying for me. What I want ...
1
vote
1answer
95 views

What does “.bashrc or prepend the Anaconda install location” mean?

I installed Anaconda from root, after completion of installation this message was displayed on terminal screen: Python 2.7.8 :: Continuum Analytics, Inc. creating default environment... installation ...
6
votes
1answer
138 views

Shell scripting bash: How to detect Alt+N keystroke?

I want to write a script that always listens in the background and execute a particular command when the user hits a specific key combination such as Alt + N. How this can be done?
0
votes
1answer
21 views

Website Files Permissions

I am trying to set all folders and subfolders (directories) to 755 and all files that are contained by folders and subfolders to 644. I don't know how can I do this from 1-2 commands. Is this even ...
1
vote
1answer
18 views

Diffrence among environment/profile/bash files

I know the difference among ~/.bash, ~/.profile vs. /etc/profile. I know (please correct me if I am wrong) configuration in ~/.bash is applicable for a specific user and terminal only.Configuration in ...
1
vote
1answer
57 views

How to install novo-builder?

Recently,I want make a Ubuntu live CD. However I don't know how to install novo-builder. The document is Install_Novo_Builder.bash. How to install novo-builder by .bash?
4
votes
1answer
63 views

How to detect keystrokes?

I have a script running always at the background. Inside that script I have to write the codes to detect keystrokes, and once a particular keystroke is detected, the rest of the script must be ...
0
votes
0answers
27 views

Update dynamic IP and fail2ban

i have a script running via cron to allow ssh only through some known IP's. Since my Home-IP is dynamically associated i use this script running every 15min: #!/bin/bash ...
0
votes
1answer
24 views

need help installing AptUrl or changing the enviromental variable

I understand how to get the file to install, I have to type out "sudo apt-get install apturl" and it should open the package for installation. I type out the command and I got this "mspyellow@BJ:~$ ...
0
votes
1answer
47 views

Problem in unmounting a disk image with a script… but not manually!

It is my first experience in writing shell scripts and something curious is happening. I'm working on an embedded system and I wanted my script test5.sh placed in the /root folder of the guest system ...
0
votes
4answers
306 views

bash script which checks input to see if it is “y”, “n” or other - not working

I have written this bash script which is meant to check your input to see if it is y, n or something else (this will be part of a larger project): #!/bin/bash echo "Have you updated the PATH ...
1
vote
0answers
64 views

Showing progress in whiptail while using sshpass and SCP

I'm writing a bash script that automates the building, copying and running of a golang app to a remote server. I'm using whiptail to let the user pick some options, enter in some details (e.g. SSH ...
0
votes
1answer
46 views

Executable won't execute

I hope that my post is acceptable although I am actually running lubuntu, not ubuntu. I am trying to create an executable file but I am having difficulties. I created a script with a text editor and ...
0
votes
1answer
46 views

for loop over character array gives unexpected “(”

I am a bloody beginner in bash scripting and I am sorry if the following is very simple. The error I get is: 4: Syntax error: "(" unexpected I am basically trying to run the following in bash on a ...
0
votes
2answers
51 views

Traverse file system and move files

I need to write a script that will go into a list of directories and then move files of cretin file types into a other directory. With the code bellow I am able to iterate over all the folders in a ...
0
votes
1answer
56 views

How can I detect when the boot sequence is complete on headless system

I have a CONF file in /etc/init to configure and start software on my headless machine. When a monitor is attached for development and testing I see that my software starts near the end of the boot ...