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

learn more… | top users | synonyms

1
vote
2answers
22 views

Alternative to 'ls -A' in Bash

Is there an alternative to ls -A command in native bash functions? Wildcard * isn't the same. I tried hard to find one, but echo * doesn't show hidden files.
0
votes
1answer
22 views

Linux sh script throws “#!/bin/sh: not found”

i have a script #!/bin/sh # Automatically remove a torrent and delete its data after a specified period of # time (in seconds). TARGET=/var/www/transmission/completed USER=name PASS=pass ...
0
votes
0answers
3 views

Fedora L2TP IPSEC VPN failure

I'm trying to connect to an L2TP IPSEC VPN server on Fedora 22. Connections have been successful Windows, Mac OS X, iOS and Android. I cannot get it to work on Fedora 22. I've followed ...
1
vote
1answer
7 views

Restart a command after it gets killed by the system

I have been using Gmvault to backup my Gmail email accounts but since the machine I use for doing this job only has 1GB memory, it frequently got killed by the system (Ubuntu) when it exhausted all ...
-1
votes
1answer
16 views

No access in the bash script

I am new to the bash script. I want to carry out the simulation using bash and I want to make it open the fortran program file. While I am writing this: #!/bin/bash echo ...
0
votes
0answers
20 views

How to recover the original file content after using Script command on the file in Linux

I have a file named file1.txt in Linux.  By mistake, I used the script command, script file1.txt its goal is to add all the terminal output to the file1.txt.  Now file1.txt is with unreadable ...
1
vote
0answers
8 views

Unable to launch matlab after installation

I have recently installed a copy of Matlab on my Linux Mint distro to a secondary hard drive. I have tried running it in different ways and none of them seems to work. I have tried using sudo, and ...
0
votes
1answer
12 views

How to configure a cron.d crontab file for root

What's the procedure for installing a cron.d crontab file to be run as root? I have a script I want root to run every 10 minutes, so I installed the file /etc/cron.d/mycron: SHELL=/bin/bash ...
0
votes
0answers
11 views

Git asks for password in cmd [duplicate]

I have tried to set up my ssh-keys on both the command prompt and git bash. What happens, is that everything works fine till I do a git <something>, and it asks for my password. Enter ...
0
votes
0answers
8 views

Linux CLI colors wrong output

I have a few different linux systems and some of them the color looks ok and right. Other ones the colors are darker and bold. I have checked my putty settings and output from dircolors and they ...
1
vote
4answers
32 views

Capitalize “FILE name.TXT” to “File Name.txt” in Linux Bash

I need a oneliner to rename all files in a directory from SomeThing.TXT NOT A FILE.ogg sensitive lalala.doc to Something.txt Not A File.ogg Sensitive Lalala.doc Most existing questions seem to ...
3
votes
1answer
23 views

Trying to create a shell script to move all files with a certain year in their name to a year based directory

Here is the block of code that I have so far. No matter what I do with the find command, I can't seem to get it to function as I want. Trying to move all files with these long year names into their ...
0
votes
0answers
18 views

Tar progress per file with pv for multiple files/folders at a time?

I've been using this one line command that I found on another post here and it works great for one folder at a time. This is the command: tar -cf - /opt/folder1 | pv -s $(du -sb /opt/folder1 | awk ...
0
votes
1answer
16 views

How do I view the tab completion function for a command in bash?

I ultimately want to alias screen -r. I mostly want to do this because that command has an awesome tab completion feature that shows me the current GNU screen sessions. I want that power with the ...
0
votes
1answer
28 views

Run command when a specific ssh config connect fails

This is a bit of a long shot, but what would be the best way of getting ssh to, if a connection fails, run a command, and then retry to connect. To share my use case, I am ssh-ing over an ssh tunnel ...
0
votes
2answers
27 views

bash - appending ' to end of command?

I stumbled across this by accident, and was wondering what it meant. What I did was I was typing adb logcat but accidentally typed adb logcat' and I was greeted to this: I Control-C'd out ...
0
votes
1answer
24 views

bash - processing output one line at a time

I read that xargs was good for processing the output of a command one line at a time (and it is). I have the following line in my script. ./gen-data | awk '{printf $2 " "; printf $1=$2=$3=""; gsub (" ...
1
vote
2answers
28 views

how to gzip and scp at the same time

I have a file in which i wanted to zip up and at the same time transfer over to another host using scp. I tried to do the following command but failed. I do not mind zipping up and scp over later, ...
1
vote
1answer
23 views

bash: Different results if same function is called from sourced script or executed directly

I've run into a something that I don't understand, and I've managed to reproduce the situtation in the script below. If I source the script it fails with head: 1: invalid number of lines. But if the ...
1
vote
0answers
23 views

Custom script in /etc/rc.local - not starting X properly

I made a script called starter.sh: #!/bin/bash while true; do sudo fluxbox & sudo -u pi epiphany-browser -a --profile ~/.config http://localhost/index.php & sleep 2s done; Which is ...
-1
votes
1answer
21 views

Trouble setting up the class path for MySQL and running MySQL via terminal

Question: what is the easiest way to run the MySQL app from the terminal What I have tried: Using some stackOverFlow suggestions I have used the following commands echo $PATH, produces ...
0
votes
1answer
19 views

How to use echo in shell command from Makefile?

I have a GNU makefile. It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW, it produces: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: ...
2
votes
5answers
70 views

Any way to avoid dot-slash when running executable scripts in bash?

let's say I have a script. chmod +x myscript Now to run this I go ./myscript But is there any way I could just run it by typing myscript ???
0
votes
1answer
24 views

alias disables colour sustainably in bash

When I do tree -N I get nice coloured output. When I then alias tree="tree -N" tree output is black & white. When I then unalias tree tree -N output is still black & white! GNU ...
0
votes
2answers
37 views

How to store formed command line without running it in bash or terminal?

For example, I have formed a long complicated command that will improve the world and lower an entropy in the Universe. But then (huh!) I see that I forgot to make a dir required. I want to store my ...
0
votes
0answers
21 views

bashrc file read error in xterm

My bashrc files is read but is not interpreted correctly. qwul@qwul-ThinkPad-L440:~$ cat .bashrc #PS1='\[\e[1;32m\]\][\W]\$\[\[\e[0m\]\]\] ' alias la="ls -a" #alias ll="ls -l" ...
0
votes
1answer
30 views

bash error when starting shell from tmux

When I open a new shell in tmux I get an error message. This error message does not show up when I start a new shell in GNOME terminal. What might tmux be running at startup that I need to check? ...
0
votes
1answer
18 views

Extract each digit of variable and store as new variable in bash

I have a variable that is a number ranging from 1 - infinity. Lets say the number is 40. I need to store 4 as a variable, and 0 as a variable. Since the number can grow beyond 2 digits, lets say the ...
1
vote
1answer
28 views

parsing condensed options to bash

I have something like this: while [[ $# > 0 ]] ; do key="$1" count=0 echo "$1" case "$key" in -r|--rotate) shift rotate $1 shift ...
1
vote
1answer
67 views

SSH Bash script for repeated commands on a network cluster

I have a network cluster of about 100 machines, a piece of software and a large list of different parameters for the software. I want to use the cluster to speed up the calculation, so each machine ...
1
vote
3answers
58 views

BASH: finding partition from diskutil output

I'm trying to search the output of a command listing local drives to find a partition called EFI on the boot HDD. I've written a really dirty oneliner as I can't seem to work out how to effectively ...
0
votes
0answers
35 views

Backup script to online backup - Pseudocode look over

I just want to pitch an idea here, before I start writing the code. I thought I build it in bash. I am not very proficient in writing scripts, but I had a few successes and this could be good training ...
0
votes
2answers
44 views

How to tell what are my startup files for sh or bash?

From this question I understand that depending on the operating system sh and bash behave differently. Doing env and alias I can tell that: Every time I open a OSX Terminal or run bash the variable ...
0
votes
0answers
52 views

bash script how to change date with hrs format and add missing days with copy of above line [migrated]

I have csv file with data: "smth","txt","33","01-06-2015 00:00" "smth","txt","33","02-06-2015 09:06" "smth","txt","34","03-06-2015 09:54" "smth","txt","34","04-06-2015 00:09" ...
1
vote
1answer
26 views

How to use unlimited list of arguments to a command in bash shell?

I'm running up against the "argument list too long" problem using a command in the shell (bash in my case). Most suggestions for working around this suggest using find or some variation, presuming ...
0
votes
0answers
45 views

Changing the HOME for Cygwin

I'm trying to change the home directory for Cygwin on a computer at work. Our home directories mapped to a network share by default. This seems to cause some confusion for Cygwin, as it created a ...
0
votes
1answer
23 views

Particular bash bc usage not storing result in variable

Unfortunately this result in a empty variable, and bc command print its result to terminal anyway while trying to attribute to aux aux=&(bc -l <<< "scale = 5; ...
1
vote
0answers
35 views

Shell Commands not working : REDHAT

I added some service to the startup script and then after reboot , i got this message- 24 package(s) needed for security, out of 52 available Run "sudo yum update" to apply all updates. -bash: id: ...
2
votes
1answer
45 views

Execute command after broken SSH connection

Is there a way to execute a command after an SSH connection is broken (blackout etc.)? When I normally log off I can just use .bash_logout but I don't know what to do when my connection breaks.
0
votes
1answer
24 views

Why does my vim colorscheme stay after I close vim?

I recently used vundle to install the solarized theme for vim on my Arch Linux machine. Whenever I open vim, the theme is applied, but it stays applied to my terminal window after I close it. I can ...
0
votes
1answer
32 views

Error while trying to execute cron script with space in path

I have a script with several rsync commands in it. The script file is placed in an NTFS partition with owner and group permissions set to root. I have no problems running the file manually from the ...
1
vote
2answers
34 views

Is there a way to make my .bash_profile load the contents of my .profile file?

I was using a .profile quite happily for two years on my Mac now running Yosemite. A recent brew install created a .bash_profile and whilst my .profile still exists, it is now no longer loaded. I ...
0
votes
1answer
48 views

Changed cygwin home location, now the terminal can't find my .minttyrc config file

I had to change the HOME location for Cygwin by setting it to pick up the directory I set in /etc/passwd (following the solution from here). It seems to not be a problem for the majority of my ...
0
votes
2answers
28 views

How do I get a bash script to echo itself into a new file?

I have a bash script. I want to have this script recreate itself in /usr/local/bin without needing an additional file to do this. bash_a.sh: ssh -t -t server-a.com " cd /var/ irb ..etc " I was ...
1
vote
1answer
16 views

bash: history -a not writing unless HISTFILE already has text

Problem statement I've been following numerous examples for doing creative things with bash history along the lines of: # simplified example PROMPT_COMMAND='history -a; history -c; history -r' ... ...
0
votes
1answer
19 views

Why does this bash file stop my tomcat if the session closes?

The following bash script starts an Apache Tomcat and tails the log file to the screen: #!/bin/bash ~/tomcats/TC1_8083/bin/startup.sh tail -f ~/tomcats/TC1_8083/logs/catalina.out If I CTRL-C the ...
1
vote
1answer
15 views

Using strace, how do I use it to get the network and serial calls

I have a python program that runs in the background, what I need to know for debugging purposing is that I need to see what calls it is send and receiving for serial, network and to stdout. I know ...
0
votes
1answer
21 views

Double SSH and execute interactive shell

I need a bash script to ssh into server a then server b then execute an interactive shell. This is what I have: ssh -t -t server-a.com exec "ssh -t -t server-b.com <<<EOF cd ...
1
vote
1answer
24 views

Remove invalid domain names with Sed

I'm having trouble writing a sed command do the following. I have a file that should only contain "valid" domain names. How I use with sed to remove any line that does not match an expression? The ...
2
votes
1answer
36 views

How do I determine the PID of my python program if there is more then one python program running?

I have two python programs running on my system, say they are called program x and program y. I want to get the pid of program y, but not x for my bash script. When using pgrep python, I get the pid ...