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

learn more… | top users | synonyms (1)

0
votes
0answers
64 views

How to add and pass system password as a variable in a script

I have a script which asks for system/login password and pass that password to further processing. This is the gist of programm by which I am executing my script. read -s -p "Password: " password1 ...
1
vote
1answer
35 views

Installing software on another computer with bash

I'm relatively new to all things Linux, but I've missed out on two really good job opportunities because I lack Linux experience. To that end I've been playing around with Ubuntu and Centos on some ...
-1
votes
4answers
272 views

How to download facebook videos by using 'youtube-dl' in linux?

I am unable to download facebook video using youtube-dl. The following error occurs during downloading $ youtube-dl ...
4
votes
1answer
92 views

How to execute a sudo script with double click

I have this script to shutdown my system after 30 seconds. I want to run this script by double clicking it (that option I changed in nautilus). This is the content of my script #!/bin/bash shutdown ...
4
votes
4answers
184 views

Blocking Start of Terminal

If you type this simple test command: gnome-terminal -x bash -c "ls;sleep 3" You will find that it returns immediately (the newly created terminal, of course, lingers for three seconds). This is ...
0
votes
1answer
49 views

error in running bash script as root

I have a simple shutdown script which i want to run as root shutdown -h +30; echo "succesfull"; I have followed these answer1,2 to make my script root. first I run this command sudo chown ...
0
votes
1answer
37 views

How to maintain a counter across multiple executions of a script?

I have a script with a conditional statement and I want to find out how many times the then clause is executed, across multiple runs of the same script. eg: if [condition] then Some code; ...
1
vote
1answer
23 views

Find ports locked to process running in the background

Is it possible to find the ports assigned to the process started on the background? I want to start a process and let it run in the background, like ./run.sh & and then see all the ports this ...
3
votes
2answers
152 views

Can alias command pass arguments?

I want to know if i can pass an argument with an alias command. for example: alias d="dmesg|grep -iw usb|tail -5" Now d will print the last 5 lines. if i want to use d to print a different number ...
1
vote
2answers
30 views

Calling Values from a .properties file?

Right now I have a simple script I want to now call a .properties file and then print the results of that file, this is what I have so far #Specific Set Variables SpecficStatus="Pass" #SetVariable ...
0
votes
2answers
37 views

I need to make a batch of users

I had written some code that would allow me to make a batch of users based on a file with usernames in it. But it eventually went from just a few lines to about 50, and I deleted it. There has got to ...
1
vote
1answer
29 views

Can't find an installed program - mathematica

I recently installed Wolfram Mathematica as a .sh file. I ran it using bash and it took me through installation. It said that the installation directory should be /usr/local/Wolfram/Mathematica/10.1 ...
3
votes
2answers
63 views

grep regex pattern causes unexpected command behavior

I'm searching for lines with $ and consecutively ' or " through this grep in my terminal: grep "\\$('|\")" -rin folder_path After pressing enter the terminal doesn't think the line is complete so ...
1
vote
1answer
19 views

bash expressions

In a bash script I have the following section. if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi What does the expressions ${1:0:1} and set -- mongod "$@" ?
1
vote
0answers
20 views

Screen in crontab

I'm trying to run 9 screens windows by crontab, and then, run some codes (basically the same for all of them), but they don't work. The code runs all of 9 screens, but run code only on the first. Aah, ...
9
votes
2answers
585 views

Piping to “type” command

I want to find out the type of several commands. Is it possible to pipe or xargs a search result from find into the type command in Linux? For example: find . -name anacron | type or find . -name ...
0
votes
0answers
28 views

Enable Vino Script Help

I have been trying to add and enable Vino to our districts Ubuntu laptops but have come up with some issues that I can seems to find a solution to and i was wondering if you might be able to assist. ...
0
votes
0answers
148 views

minimal bash-like line editing is supported. Problem after a fresh installation of ubuntu 14.04.2

So I had ubuntu on my NUC. It was great I have to power on and ubuntu start. But I had a problem and I had to reinstall everything. I erase everything and install to have a fresh ubuntu. Everything ...
4
votes
4answers
84 views

Terminal: Avoid repeating directory multiples times to reach files within

I have two files file1.txt , flie2.txt in a directory X. I want to copy those files to my current working directory which is far away from the directory X. so I end up with a command like: cp ...
3
votes
2answers
109 views

Recursively rename files [duplicate]

there is a whole bunch of files all of them who have the pattern joob_1_1 joob_1_2 joob_2_1 joob_2_5 so it is joob then underscore numeric underscore numeric - these are also the only files in the ...
0
votes
1answer
32 views

how to pass single file not list of files

I am running this command while IFS= read -r file;do split -l 20000 -d "$file" "$file";done < file.list.txt now my problem is that this accepts as input a list of files (file.list) which looks ...
0
votes
1answer
58 views

Execute scripts and Java programs from apache/PHP

I'm trying to allow apache and PHP to execute a script I have written that is located in /usr/local/lib the script in question is called "pathy" has been added to the path in my .profile, and I can ...
1
vote
1answer
21 views

Problem while trying to create an alias

Goodmorning I was trying to create an alias so as to launch matlab easier. I read this post :How to create a permanent "alias"? and I used the commands in this line echo "alias ...
0
votes
1answer
32 views

How can I move a file to a directory?

I just want to read from the keyboard the file's name and move it to another directory. I have this in my mind : ls read a // the name of the file pwd read b //the name of the directory where I ...
1
vote
2answers
56 views

Determinate if a file is already opened

I want to create a bash script to determine if my file is already opened by another user. I have already tried with lsof but it didn't work as i wanted. The files can have different types of ...
5
votes
1answer
241 views

Working with text files encoded as Windows-1250 and UTF-8

I am switching between Ubuntu and Windows frequently therefore I have some encoding problems with text files. If I save text file in Ubuntu, everything works fine in both systems. But Ubuntu doesn't ...
0
votes
0answers
58 views

How to turn ON/OFF screen monitor using shell script and 'xrandr' linux command?

I am trying to turn on and off screen monitor in Ubuntu14.04 using key bindings. I tried following shell script #!/bin/sh output=$(xrandr | grep ' connected ' | awk '{print $1}' | head -1) ...
4
votes
2answers
383 views

How to create a rotation animation using shell script?

I looking for a script that creates a rotating animation using character /,-, | and \. If you continuously switch between these characters it would look like its rotating. How to make this?
2
votes
1answer
99 views

How to make a batch file add users to groups?

I need help with a GCSE project, I'm stuck on the last question. It asks for a bash script to create users, and then assign them to groups. I've already made the script add new users, but I'm unsure ...
2
votes
1answer
78 views

Stacking multiple for in commands

I'm operating on large amounts of data, and have a protocol involving several scripts. I launch it separately for each input file, simply swapping filename in text file containing the command. I would ...
0
votes
0answers
44 views

Copy standard output to file

Script 1 uses echo (and other commands) to standard output. Script 1 also runs other scripts, which also use echo (and other commands) to standard output. Script 1 is called by a scheduler that ...
2
votes
2answers
54 views

How to set environment variables separated by dots

I have to set an environment variable separated by dot in my tomcat startup script. For example host.name=localhost I know shell doesn't accept dot separated variables. Is there a work around ? I ...
2
votes
2answers
99 views

How can I find windows of a specific application and place them into a grid?

I'm trying to write a script to identify all open chrome windows and move them into a grid layout on a large screen I'm not sure how to find out what the best resolutions would be so I was going to ...
0
votes
2answers
58 views

-bash: ./configure: Permission denied

When I run the command ./configure in Ubuntu for installation of the siesta-3.2 software, bash complains with this: ./configure: Permission denied. How can I resolve this issue?
-2
votes
1answer
34 views

chmod u-x problem in case statement in Shell Script

I want to give rights to a file using a menu (exec,write,read). If you look closely I read value B( the file's name) then I use the case function to do the 1)exec / 2)write / 3)read function for ...
2
votes
1answer
26 views

How to delete User with User ID and GID 0

I just created a user with UID and GID to 0. Now when I access this user lets say "abc" will login as root. But when I loin as root i cannot list all the directories with ls command where i can do it ...
3
votes
2answers
175 views

changing string with sed, where did it go?

$ cat test-paths.txt test/sub2/configuration.php test/sub3/configuration.php test/configuration.php test/sub1/configuration.php $ cat find-host-test #!/bin/bash for i in `cat test-paths.txt` do ...
1
vote
1answer
28 views

scripting a “manual” apt-get install of kept back packages

TL;DR: is there a way to "automatically" install any kept back packages? I know that apt-get dist-upgrade is too blunt of an instrument. Details... I have a bash script that runs (periodically) to ...
4
votes
3answers
117 views

How I can monitor new files in a directory and move/rename them into another directory?

A program generates output textfiles, named output.txt, after every 15th iteration of a certain process. Doing so, it overwrites the last output.txt. I want to keep the files however, and I can't ...
1
vote
1answer
43 views

I cannot get grep to print results

Total noob here. I am blindly stumbling my way through bash. I realize that there is a syntax error in the following script but, I cannot figure it out. The script just sits there. #!/bin/bash ...
4
votes
2answers
78 views

Why my bash-script doesn't work with cron?

I created a bash script to automatically update my Ubuntu Server. Here is the script: #!/bin/bash apt-get update apt-get upgrade echo "Update am $(date "+%d. %m. %y|%H:%M:%S) >> ...
1
vote
4answers
126 views

bash shell script

How do I write a bash shell script that requests the user's name, verify that it exists and, if it does, show the following information: Username: xxxx User ID: xxxx Group ID: xxxx Shell: / bin / xxx ...
1
vote
0answers
21 views

sed single qoutes, double qoutes, delimeters [duplicate]

I am confused a little bit. I would like to swap 2 directory in the apache2 config files with the sed program. APACHE_CONF=/etc/apache2/apache2.conf FULL_DIR=/home/$USER/new ...
0
votes
1answer
74 views

How to execute an script as daemon with nohup?

Supose I have a script "script1.sh" and I want to execute it as a daemon with nohup and &, and make it be "waiting" for a signal. How should I do that?
12
votes
1answer
468 views

How to get the PID of my script?

If I have the script "script1.sh" and I want to make it print its own PID as a first step. How can I do this in bash?
3
votes
2answers
225 views

How to execute all scripts in a path?

Suppose I have a script that receives a path as a parameter. How could I execute all the scripts located in that path?
0
votes
0answers
27 views

Bash script not creating screen

I have a script that I wish to run on a screen. The screen that already exists is killed correctly, however the screen is not created and the command not run. Any ideas? #!/bin/sh screen -S attorney ...
5
votes
1answer
254 views

How to automatically install a program bash suggests I install?

I am thinking of the use case of this output: The program 'tiger' is currently not installed. You can install it by typing: sudo apt-get install tiger How can I get it to prompt me to install ...
1
vote
1answer
28 views

Combine setsid with .bshrc alias or launcher

To run program X, I currently have to type path/to/folder/X in my terminal. I made an alias in my .bshrc so I can type X directly, and I have created a launcher so I can access X directly from my GUI. ...
5
votes
3answers
271 views

How can I execute the last line of output in bash?

I know I can run the last command in bash, with !!, but how can I run the last line of output? I am thinking of the use case of this output: The program 'git' is currently not installed. You can ...