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

learn more… | top users | synonyms

0
votes
2answers
12 views

How to get `make` to recognize alias command

I am installing MOOG, and when I make -f Makefile.maclap I get the error $ make -f Makefile.maclap g77 -w -c -o Abfind.o Abfind.f make: g77: No such file or directory make: *** [Abfind.o] Error 1 ...
0
votes
0answers
5 views

How to store data from different netcat connections in separate files?

I need a server that should receive data streams, store them in files and send further. Each connection should create a file with corresponding timestamp in file name, then write to it. My solution: ...
20
votes
5answers
5k views

Substitution in text file **without** regular expressions

I need to substitute some text inside a text file with a replacement. Usually I would do something like sed -i 's/text/replacement/g' path/to/the/file The problem is that both text and replacement ...
0
votes
0answers
6 views

“fortune” command no output when running as daemon

I execute the fortune command from a daemon, but I don't get any output. If I run the bash-file from command-line I get the output without problems. echo "$(fortune)" The daemon is the Telegram-CLI ...
0
votes
2answers
25 views

Shell script to pass multiple arguments with options in command line

I have the script, I need to execute this script like this: ./create_endpoint.sh --controller-ip 10.20.20.1 --controller-name User1. But its executing like this: ./create_endpoint.sh 10.20.20.1 ...
0
votes
2answers
3k views

“Reset” colors of terminal after ssh exit/logout

When I ssh into a remote server, I like the colors of the terminal to change. I use setterm on my remote ~/.bashrc file to get this done. However, when I exit, the terminal colors are not reset to the ...
3
votes
3answers
5k views

Rsync print only files that would have been changed

Is there a way to get rsync to print the full filepaths to all files that are different without actually transferring any files? Alternatively, I need a way to diff the files across two trees (over ...
0
votes
0answers
3 views

Script to monitor realtime CPU & Bandwidth usage in xen live migration

I need to write a script (bash or python or ??) to perform live migration of a VM in xen, and to simultaneously log and extract the CPU & bandwidth usage of the Domain-0 AND write the output into ...
16
votes
6answers
25k views

When to use Bash and when to use Perl/Python/Ruby?

We are doing all our scripting with Bash so far, but I'm starting to feel a bit silly about it. While we can of course do everything we want with Bash (it's quite powerful), I'm starting to wonder if ...
0
votes
2answers
30 views

Accessing shell variables inside 'sudo' block : export doesn't work

I am writing a script to fix a missing 'F' letter in a mail log file. The mail log file is continuously updating. I am getting a file name, after that I am doing 'sudo su' to get superuser access. ...
3
votes
1answer
3k views

Two parts: linux startup script to connect to bluetooth and cron to keep it connected

I have a mini bluetooth keyboard and a Raspberry Pi running a Debian-based distro. I know the MAC address of the keyboard but for this question, let's just use AA:BB:CC:DD:EE:FF. Right now I have to ...
5
votes
1answer
331 views

Most efficient way of taking a subset of lines

I have two files. One huge one (200.000+ lines) called 'db' and one big one (15.000+ lines) called 'indices'. What is the quickest way of filtering out the lines in 'db' containing any index ...
-2
votes
0answers
21 views

How to get total records affected in database: A shell script

I have written a shell script to update the records on database server. The query.sql file contains variable number(almost 600 to 800)of insert queries. As I am running the script, it runs fine and ...
1
vote
2answers
31 views

Adding non-executable (Tex/text) files to my PATH?

I have two files that I would like to call from any one of multiple working directories on my computer, so I added them to a folder of resources that I've added to my path (and then sourced my ...
0
votes
1answer
10 views

I am trying to run a cronjob but it is not executing correctly

I have the following line in my crontab */1 * * * * /usr/bin/screen -S lftp /bin/bash /media/c419d280-9833-4432-b5a5-520f040b87ec/NASDataDisk1/Other/autolftp-sftp.sh >> ...
0
votes
0answers
18 views

Group permission doesn't work for group

I'm trying to give me permissions to write on a file owned by www-data me@home $ touch my_tralala && chmod 660 my_tralala me@home $ sudo chown www-data:www-data my_tralala me@home $ groups me ...
5
votes
2answers
5k views

ssh config under cygwin

I have Cygwin installed on Windows 7. I made default install. I would like to use ssh config file (~/.ssh/config) to set host and options for connecting. Normal ssh command is not able to find the ...
5
votes
2answers
1k views

Why does setting the bash prompt (PS1) manually cause root to have a $ instead of a #?

I'm on CentOS 6.4. By default the root user's prompt has # symbol, i.e. it looks something like [root@myserver ~]# . echo $PS1 prints out [\u@\h \W]\$; but if I do PS1="[\u@\h \W]\$" (which shouldn't ...
1
vote
1answer
16 views

Error with command cut: the delimiter must be a single character

I am trying to run this command from console: # HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` But got this error: Try `cut ...
2
votes
2answers
973 views

How do I find out where paths in my $PATH were defined?

There are some paths in $PATH, which I don't want. I'm not sure how they got there; they aren't coming from my .profile. Is there a way to determine which scripts are modifying $PATH?
0
votes
1answer
12 views

Variable as argument to Wine

The variable $INPUT_FILES in Case 1 has the same content (string) that is used in Case 2. Why in Case 1 I have problems with spaces in the name "2015 01 09.1.txt", but in Case 2 not? How can I fix ...
0
votes
1answer
15 views

Remove version information from maven generated war file

I am trying to automate the deployment of war files that are generated by our build server using maven. I need to be able to extract the project name from the war filename so I can rename the file ...
4
votes
3answers
20k views

Connect to WiFi network using Mac Terminal

Every time I try to find out how to do this, I find out how to do it on a linux, and it doesn't transfer. How do I connect to a WiFi network using Mac Terminal Bash?
-1
votes
0answers
22 views

How to find the newest file in web directory using bash?

How can I find the newest file in web directory (having link) with bash? Linux It would be great to have something similar to ls -tr | tail -n 1 but with wget probably
0
votes
0answers
20 views

RHEL 6 converting a BASH script to a CSH script

I have a BASH script( running on RHEL 6 ) that brings up a GNOME terminal, opens multiple tabs in that terminal, starts a server in each tab, names the tab after that server, and inserts the command ...
0
votes
0answers
21 views

RHEL 6: GNOME: staring a *.desktop file in a shell different from the system default

I'm in RHEL 6 with bash as my default shell. I have a script called startServers I made a startServers.desktop file which I put on my desktop so I can have the convenience of clicking on an icon to ...
0
votes
2answers
33 views

Bash - using grep on user-defined strings

Sometimes I would find it very useful to be able to use grep on a string (without the string being in a file). For example: var="Some random string" $var | grep -e "Some" I guess I could use echo ...
2
votes
1answer
24 views

Why does ZSH local variable assignment fail?

I was reading this question and answer: zsh - variable assignment isn't working. The post explains how to fix it, but not why. Why does the local variable assignment fail in that case ? There ...
0
votes
1answer
41 views

“/bin/bash: bad interpreter: Text file busy” even though the file editor closed the file

I have a script on Linux that I edit under Windows (through Samba), that starts with the shebang line #!/bin/bash. Even though: I finish editing, save, and close the file in the editor make sure ...
5
votes
1answer
215 views

Explaining the -W flag for rm

What does the -W flag for rm do (on BSD or Mac OS X)? According to its man page, the flag attempts to "undelete the named files." And currently, "this option can only be used to recover files covered ...
0
votes
1answer
52 views

What does this bash script?

In theory, this snippet from pentoo-installer finds all partitions on the selected disc, but it doesn't find my sda1 partition, so I would love to understand it and modify so it does. ...
2
votes
2answers
354 views

How to get Bash colours in a Word or PDF document

I've got a Bash script that outputs results with pretty Bash colours, and I need to include the output with colors in a Word document. I would like to avoid putting a screenshot as the ouput is ...
0
votes
2answers
23 views

How to reflect changes in PATH as done by a user script

I have a script which does some basic root PATH integrity check and inputs a line in ~/.bash_profile to source my script, so that changes my script made in root's PATH is permanent across restarts: ...
0
votes
0answers
31 views

Fedora 22 Docker Container unable to network

I have been struggling with Fedora 22 and getting Docker images to be able to communicate with the outside world. Not sure how to start testing this, or even where to start to look. Let me explain ...
0
votes
1answer
42 views

How to recover the Linux VM after accidentally deleting all root folders?

I have a CentOS Linux VM running in VirtualBox. I wrote a bash script to do some automated tasks. But I accidentally deleted all root folders because I put a line in the script rm -r $my_dir/* ...
-4
votes
0answers
42 views

How to convert a string to decimal values? [closed]

I would like to convert word (i.e., a string) to decimal ASCII values, separated by dots, in bash. Example word: test123 Expected result: 116.101.115.116.49.50.51 This is what I have tried so ...
1
vote
1answer
16 views

Clear Bash quoting with JSON

I looked at similar questions before, but does not exactly answer my issue. I'm using cURL to send a JSON request, like this: curl -X POST -H "Content-Type:application/json" "$HOST" -d '{"uri": ...
0
votes
3answers
39 views

How to append multiple .txt files to one file without header line

I have 100,000 .txt files with format below: bygrp,colnum,beta 100005,1,0.629519434191718 100005,2,-0.500000000026516 100005,3,0.560850895321124 100005,4,0.119624318119292 100005,5,0.257676682753309 ...
0
votes
1answer
25 views

Bash - enable execution only if script is run from a specific directory

I need to write a shell script that can only be executed if it is run from the home directory of the currently signed-in user, and I have no idea how to check that from the script itself. Any help ...
2
votes
5answers
2k views

How to work around shell limitation of 'Argument list too long'?

How can I work around the bash shell limitation of 'Argument list too long' when using filename wildcards that match a ton of files in /tmp/? [my-centos4 tmp] rm -rf /tmp/myLocalFiles* bash: /bin/rm: ...
0
votes
0answers
17 views

bash change directory with “shortcuts”

On my windows computer I use JPSofts "Take Command" a.k.a. TCMD as command.com or shell replacement. One tcmd feature I really miss when working with bash on Linux/Os X, is the extended directory ...
13
votes
5answers
21k views

Continuously re-execute a command when it finishes in Bash

I'm trying to figure out a simple way to keep re-executing a command whenever it finishes, for any reason (error or otherwise). What would be the best way to approach this? EDIT: I wasn't clear ...
1
vote
1answer
13 views

ConEmu and ASCII characters

I've been using ConEmu for quite a while, and I'm having some problems with ASCII characters in it. This doesn't happen with other terminal emulators, such as urxvt or mintty, here's a shot with the ...
11
votes
4answers
26k views

How do I rename files with spaces using the Linux shell?

I named a number of files with spaces in them, and I want to replace the space with "_". However, every time I write a command in the shell with the file name (eg "Spring 2011"), the shell doesn't ...
2
votes
1answer
31 views

chroot: failed to run command ‘/bin/bash’:

I am trying to modify a kernel image before using it for qemu. I am trying to add a compiled binary to the image. I am using 64 bit Linux 14.02. What I am doing is, linaro-media-create --image_file ...
1
vote
2answers
4k views

How to auto commit to my git repository using cron?

I look into a lot of answers about this subject, but something is wrong here, let me explain. I create this script, to make my cron cleaner :) #!/bin/bash cd ...
0
votes
0answers
10 views

SELinux issue with php_shell_exec

I have a php site on CentOS7 that needs to use some shell scripts using php_shell_exec. But the scripts do not run due to SELinux (that I require). None of the scripts use sudo, I understand that ...
0
votes
0answers
5 views

Name a tab in iterm2, even with pane splits

I see there are solutions to name tabs in iterm2 when there is a single pane, but it doesn't work well with multiple panes/splits. So if I have two terminals open in a split under a tab, I would need ...
3
votes
1answer
17 views

Accidently running perl-script with sh, how to detect that and take actions?

I had a bash-backup-script for quite some time which worked ok for me, but now I needed some features and put them into a perl-script. It works perfectly fine, and I'm happy. But my muscle-memory ...
1
vote
2answers
59 views

bash: find and zip all subfolders of a folder

how would one find all subfolders of a folder and zip them separately ? folder structure ./folder -subfolder_1 -subfolder_2 -subfolder_3 expected result: ./folder ...