Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

0
votes
0answers
27 views

command_not_found_handler not allowing cd command

I have the following code block in the ~/.bashrc file function command_not_found_handle { for dir in $@; do path="${path}${dir}/" done if [[ -d ${path} ]]; then echo "...
0
votes
0answers
32 views

I have an issue with the cron

I have this script : #!/bin/bash if [ ! -e /home/mam/restart.lock ]; then touch /home/mam/restart.lock killall arma3server /home/mam/arma3server & fi I made a cron like that : * * ...
0
votes
2answers
55 views

What is the name of the command (function) that runs after a command has failed?

When run a command, if the command is not present, then some information regarding the failure of the command is displayed. I am trying to take the information about that failed command as input to ...
0
votes
1answer
32 views

How can I compare and delete duplicate files between multiple folders on El Capitan?

I'm dealing with two different types of file on OS X El Capitan. They have the same file extension but have tags at the end of the file name (e.g., abc123_m.psarc and abc123_p.psarc). I have one ...
3
votes
0answers
23 views

How to send trackback to arXiv papers from a Jekyll blog?

Sorry, my question was directed from Academia.SE here by the admins. If there is a better place to ask this question, please let me know as well. I have recently noticed that arXiv.org website ...
0
votes
0answers
21 views

bash on windows cannot 'see' mysql server started from Windows environment

I have a WAMP stack running from my Windows environment. But because I much prefer the Unix environment, I issue my symphony commands from within Bash on Windows (the Ubuntu Linux for Windows ...
0
votes
1answer
33 views

.bash_profile broke my ipython, conda

I am using a Mac OSX, updated my bash_profile after following the instructions in one of the Udacity courses. However I am no longer able to access to my ipython notebook or even conda. I get the ...
0
votes
0answers
18 views

Cannot make function key bindings (F1-F12) to work in byobu with tmux backend

I use Ubuntu 14.04 and have the latest version of byobu installed via apt-get. It has always worked flawlessly but started showing some weird behaviour just recently with no obvious reason. I use it ...
0
votes
0answers
86 views

Windows 10 Linux Subsystem SSH client Resource temporarily unavailable

I am trying to ssh into my remote server within the Windows 10 Linux Subsystem. I am using MS Windows 10 Home Insider Preview build 14366. While at the command prompt, I type: ssh user@domain.com ...
0
votes
2answers
53 views

In Bash, how to randomly select a file from a static list?

I have this bash script while true ; do for i in * ; do cp "$i" ~/slideshow.jpg ; echo $i ; sleep 5 ; done ; done How can I randomize this process?
1
vote
2answers
8 views

Sorting files by “line content” frequency

Imagine that there are 3 text files. 1.txt: a b c 2.txt: f c d 3.txt: b c f How do I sort them by frequency of each "line content"? (In case of collisions alphabetically) Result: c b f a d
1
vote
0answers
22 views

tmux always starts with `/bin/bash` instead of `/usr/local/bin/bash`

No matter what I do, tmux will always use /bin/bash as its login shell. I have set $SHELL to /usr/local/bin/bash which should work according to the man page of tmux. And $SHELL is definitely exported,...
0
votes
1answer
28 views

If block executes 2nd command on false

I am a bash newbie (a PHP dev posing as a Linux sysadmin). I have the following if block in a bash script: if [ "$DAY"=="Sunday" ]; then cp /Drive_D/videos_bu/daily/$TODAY /Drive_D/videos_bu/...
1
vote
1answer
26 views

Purpose of /etc/X11/Xsession.d files

I'm with linux and have some questions about Xsession. As I understand /etc/X11/Xsession script is launched when X Window System session is begun. But as I was examining code in /etc/X11/Xsession.d I ...
1
vote
1answer
21 views

Start an interactive session in gnuplot and execute some commands when it opens

When I execute my script, it should Open a terminal with gnuplot (interactive session) Execute some gnuplot commands. The interactive session stays open. (user can execute commands) I've tried the ...
1
vote
1answer
36 views

How to keep and aggregate bash history across multiple machines?

I normally SSH on multiple remote hosts which are VMs and re-create them every 5-6 days. I loose all my bash history in those VMs as soon as I destroy and re-create them. Is there a way I can share ...
0
votes
0answers
14 views

HandbrakeCLI bash batch script only transcodes one file and exits

Iam writing a bash script that loops through webm files and transcodes them to .mp4 using HandbrakeCLI. However, to my surprise, Handbrake only transcodes one file instead of all of them. Here's my ...
2
votes
2answers
29 views

Running a Ruby script once at Linux login

I have a Ruby script which takes quite a while to run (5-20 seconds in most cases) and its purpose is to generate configuration files for Conky and Fluxbox. At the moment I have the Ruby script set ...
0
votes
1answer
10 views

is calling remote bash script via https which then call another bash script with http considers secure?

It might be a silly question but I will go for it anyway… due to some backward compatibility I only adjusted part of the calling script chain. there is a reason why I call it twice but let's leave it ...
1
vote
0answers
23 views

Bash script quits after command

My bash script quits after running the first command, why? It outputs the result of ntpstats and stops #!/bin/bash # Output ntpstats ntpstats echo "" # Output ntp query ntpq -p
0
votes
1answer
28 views

Compare Two Files in Linux

I am trying to compare file A with pattern file B and show the matched lines of file A. X can be replaced by 0 and 1 in file B. File A does not contain any don't cares. File B is a large file. For ...
0
votes
0answers
17 views

Shutdown script not running

I configured a Minecraft server to run at startup inside a screen session. I'm on an EC2 AWS Instance. I would like to stop it at shutdown, so I created the following file inside /etc/init.d /usr/...
1
vote
2answers
33 views

Create new user loop

I want to create a new user script that I can loop for creating a second or third. So far I have something like this, but i'm stuck on the rest. #!/bin/bash echo "Do you want to create a new user (y/...
0
votes
2answers
10 views

How to cat multiple lines and delete existing contents

I normally run a command like cat <<EOF >> /path/to/file some stuff more stuff EOF However, this time, I want to overwrite the existing file and not append to it. How can I accomplish ...
0
votes
0answers
27 views

bash script + printf + how to indent the lies with printf

I have many files like the following ( the same concept on all the files ) more list-OS23 linux-d linux-01 fedora-linux-c Solaris_machine1 AIX-65 linux-redhat18 unixware7-h unix-...
0
votes
1answer
37 views

Windows 10 Ubuntu Nginx Port in Use

I installed the windows 10 technical preview to use the Ubuntu subsystem, but upon installing nginx I can not start the service. Here is the error log:
1
vote
0answers
18 views

Converting JPG to MP4 green output

I'm trying to convert JPEGs to MP4 using ffmpeg. I've got the process working for PNGs so I know I'm heading down the right track. With when ffmpeg finishes processing a JPEG, the resulting MP4 can ...
0
votes
0answers
12 views

Record all child processes spawned by a program/script

I want to record all child process Ids spawned by a long running program. Is there a way we can do that? Lets say we are running a script which does build+test and runs for an hour spawning many ...
0
votes
1answer
34 views

Run Windows app from Ubuntu on Windows

I'm using bash on Ubuntu on Windows. I navigate to a folder and from there I'd like to open a file in a Windows program. For example: After entering cd \mnt\c\Users\myusername\Desktop notepad index....
-1
votes
1answer
51 views

Bash Script to backup and restore directory structure

Basically I have this directory structure in Linux. Backup Dir_1 Sub_Dir_1 file_1 90 GB file_2 10 GB Sub_Dir_2 file_1 20 GB Restore Dir_1 Sub_Dir_1 ...
0
votes
0answers
10 views

How to configure AWS EC2 user data values and bash script

When launching a AWS EC2 instance, you can give a user data string that is interpreted either as key, value pairs with some configuration variables, or as a bash script, if it begins with a #!/bin/...
0
votes
2answers
37 views

How can function definition be part of pipe sequence in POSIX shell grammar?

The POSIX shell grammar at http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02 says pipe_sequence : command | ...
0
votes
0answers
27 views

How do I get bash history for users running commands via PHP shell_exec()?

Is there a .bash_history or something similar stored out of memory when running shell commands via PHP's shell_exec() or backticks? PHP is running Cloudlinux+FPM multi-tenant where each user owns its ...
2
votes
1answer
28 views

bash find list of archived files with wildcard in while loop

I have a few thousand gzipped text files in different subdirectories and used a subset of these files as input for a project a few years ago. Back then I had an unzipped copy of the files I actually ...
0
votes
2answers
42 views

How to convert date from number format to String format?

My input is [10/04/16 01:02:03 BST].How can I convert to Apr 10 16 01:02:03? And I dont want to replace / to-.
0
votes
1answer
24 views

Rezip file without creating temporaries

Maybe it's best I just start off with the use case. I have a large zip file full of many files and I suspect it was originally zipped at a low compression level. I want to create a new zip file from ...
3
votes
1answer
34 views

Bash move and rename by parsing the output of find

I have nested directories of pdf files and I would like to extract them to a higher level directory renaming them as follows: My files are something like: ./path1/pathA/fileI.pdf ./path1/pathB/...
0
votes
0answers
16 views

How to force dialog windows to be displayed in front?

When I open a zenity dialog window with bash, the window is always displayed in the background rather than in front of the terminal window. For example zenity --info --title='Just a title' --text='...
0
votes
2answers
40 views

How do you re-source the environment variables in a command prompt in Windows?

In a bash shell, you can edit your environment variables, run source ./.bashrc and refresh the values of environment variables in an already open shell. Does Windows have a similar command that you ...
-1
votes
1answer
18 views

How can I filter a list of files to download those that don't already exist?

I have downloaded some files into a folder, but the download was interrupted and not all the files were downloaded. I do not want to redownload the gigabytes-worth of files I already have; I now want ...
0
votes
1answer
29 views

Last background process ID ($!) not working in sudo bash command

Do shell variables work inside sudo executed commands? I'm trying to run, and later kill, a background process, as another user inside a script. However, I cannot capture the background process ID, ...
1
vote
1answer
47 views

How to kill a daemon in Linux?

Note: Before you mark this question as duplicate, please note that I've tried all the solutions that I could get online, but still I'm unable to resolve the problem. I ran daemon through the ...
1
vote
1answer
24 views

bash xargs: same command gives different output

When I run ls -1 *.a | xargs -I{} echo {} | sed 's/.a//' The output is 1 2 3 When I run ls -1 *.a | xargs -I{} bash -c "echo {} $(echo {} | sed 's/.a//')" and the output is 1.a 1.a 2.a 2.a 3....
0
votes
1answer
16 views

Passing array values to command args

I’m trying to write a script which executes a command to each of the elements of an array, independently of the number of values in it. However, the only solution I come up with is the following (made ...
1
vote
2answers
29 views

gunzip multiple archives to specific folder

is there possibility to gunzip multiple files into one folder? I have alot of access logs which I need to exctract do folder. There placed in /var/log/nginx/ and they are named like access.log.2.gz ...
0
votes
0answers
19 views

Run multiple Synergy servers

Currently I have a Windows PC & Linux workstation running Synergy. One is the client and the other is the server with the physical keyboard and mouse. I was wondering if it is possible to add ...
2
votes
1answer
23 views

Passing variables into ssh sessions (Session has to stay alive)

is it possible to start a ssh remote session and pass a variable to the remote host, which is usable in the opened session. For Example: Client: testvar="this is my text" Open ssh session (ssh user@...
0
votes
1answer
37 views

Shell script fails when executed by systemd service

So I have a systemd service called startup.service: [Unit] Description=startup scripts [Service] Type=oneshot ExecStart=/home/user/Documents/Tools/Scripts/startup.sh [Install] WantedBy=multi-user....
0
votes
1answer
32 views

Difficulty getting /etc/rc.d/init.d tomcat startup script working

I have the following startup script that on reboot does not bring up tomcat: #!/bin/bash # # description: Apache Tomcat init script # processname: tomcat # chkconfig: 234 20 80 # ### BEGIN INIT INFO #...
0
votes
1answer
62 views

create firefox profile in virtual terminal

As part of a system setup process, I'm trying to create a default firefox profile on the command line using firefox -CreateProfile default and then proceed to customize settings, etc. This works ...