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

learn more… | top users | synonyms (1)

1
vote
1answer
27 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
22 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 if statement is executed (no loops in the current script). That is how many times the script got executed. eg: ...
1
vote
1answer
14 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 ...
4
votes
2answers
108 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
19 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
28 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
20 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
39 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
15 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, ...
0
votes
0answers
13 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
27 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
79 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
86 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
22 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 ...
-1
votes
1answer
50 views

help with my script “path of shell” [on hold]

I usually php but also use bash to automate tasks on my server. I am trying to test this bash script but I'm not sure what "path of your shell" means. If anyone could help me with what i am meant to ...
-1
votes
0answers
31 views

Convert perl to shell/bash [on hold]

I understand C and C++ and new to perl scripting. I must convert the perl script under the following url to shell or bash: ...
0
votes
1answer
20 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
16 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
31 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
53 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
111 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
16 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
319 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
63 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 ...
-1
votes
1answer
25 views

Bash Script to periodically update images [on hold]

How can I set up a script that will take the most current image in a folder on a remote server, and display the most current images on my host device. Possibly updating the image every 30 seconds? Any ...
2
votes
1answer
55 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
38 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
39 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
78 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
28 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
24 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
18 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
146 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
22 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
73 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
38 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 ...
0
votes
0answers
46 views

Xubuntu 14.04 Desktop Won't Load [closed]

This was a new install of 14.04 and it was working good for a month or so with the exception of my left and right monitor positions would not save so they were backwards after every reboot or logout. ...
4
votes
2answers
61 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
102 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
30 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
436 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
199 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
20 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
236 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
18 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
207 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 ...
0
votes
0answers
13 views

How can the outputs of sounds be set by command in PulseAudio?

I'm trying to automate the setup process needed to pipe the output of Festival speech synthesis into Skype for the purposes of allowing a person who cannot speak to have a synthetic voice on Skype. I ...
0
votes
1answer
35 views

Anyway to get full bash working on Windows? [closed]

So I love the Linux CLI environment and I like to use bash for almost every task I can. For some reasons too long to explain, I'm leaving my Ubuntu 14.04 LTS to move to Windows 7. I have heard there ...