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

learn more… | top users | synonyms

1
vote
0answers
54 views

How to ls -l file from output of grep

I was trying to run the following command: ls -lh `grep -E "^log4j.appender.File" /var/domains/*/servers/*/logs/log4j.properties | sed 's/.*=//g'` but it shows me error: ls: cannot access ...
0
votes
0answers
35 views

SFTP key authentication not working from bash script

I am trying to set up a very simple bash script on Ubuntu that SFTPs to a specific server using public key authentication. When I run the command directly on the command line, it works like a charm: ...
0
votes
1answer
31 views

run script after xserver started

I have a script which I would love to run after xserver has started. This file is located at /home/karl/.scripts/startup/sensei-raw-startup.sh. How to I invoke this file after xserver has started?
0
votes
0answers
40 views

Why does this Unicode character get mishandled when I ssh in from a different remote server?

Normally I ssh into a computing cluster from my work machine running OpenSUSE and submit a bash script to a condor queuing system that runs an R program. When I ssh in from my Windows 10 laptop ...
0
votes
1answer
29 views

Getting output of another script while preserving line-breaks

I'm running a C program from a bash script and would like to capture the last line of output and the exit code. This is what I did: echo output=$(echo $op | ./compute) echo $output echo "$output" ...
0
votes
0answers
27 views

bash how to remove “__bp_precmd_invoke_cmd” error?

I get after each command the error bash: __bp_precmd_invoke_cmd: command not found even after the command is successfully executed. e.g. if I run the ls command I get the proper listing of the ...
1
vote
1answer
45 views

Regex to match “a string of length less than X resides between two ”>“ symbols”

The have text in this form: >xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx >xxxxxxxxxxxxxx xxxxxxxxxxx > I need regex to match all >xxx... if there is ...
0
votes
1answer
38 views

Add entry to newly created crontab using shell scripting

I would like to add an entry like */15 * * * * php -f /var/www/cron.php to a newly created crontab using shell scripting in Ubuntu 14.04. The purpose of this is to automatically provision a ...
0
votes
1answer
52 views

Executing cmd script remotely on Windows

I am using Airytec Switch Off which creates a server on Windows that accepts commands on a specified network port and executes scripts remotely. Turning off/restarting PC works fine. Then I created ...
0
votes
1answer
23 views

How to store an ssl key as a variable in a script for use with ncat?

I am trying to write a wrapper script to start an ncat listener. I don't want to have to output the certificate and key to a file, rather I'd like to store it as a variable within the script, and call ...
0
votes
1answer
66 views

How to write “!” symbol between double quotes in bash? [duplicate]

I can't figure out how to write ! symbol in bash scripts when putting it in double quotes strings. For example: var="hello! my name is $name! bye!" Something crazy happens if I type the following ...
2
votes
0answers
56 views

Force Ubuntu user to use specific shell

After years of reading helpful questions/answers on superuser, today it's my turn. I'm playing around with "lshell", a linux shell written in python (lshell on github) which gives the opportunity to ...
1
vote
1answer
27 views

PATH variable not working properly with hg

I am having a CentOS remote machine where I have hg installed. It was working fine for long time and today when I am trying to use hg commands, I got the following errors, [dinesh@lab test]$ hg st ...
6
votes
1answer
79 views

How to make bash keep most frequently used history entries for ever?

Duplicates are already turned off, but that's not enough (I feel like I have to enter commands too often). Assume I have a capacity of 2000 entries of by bash history and a command which I used very ...
0
votes
1answer
45 views

mv in for loop : “when moving multiple files last argument must be a directory”

I try to rename few files, omitting the first n characters. In fact I want to remove the [ www.blabla.com ] prefix (18 chars). I'm on windows, using bash command on Git-bash. I've tried this ...
-1
votes
1answer
69 views

bash - string manipulation get string before or after substring

good day all this is a noob question, but I can't seem to find the answer to this anywhere. Other functions like 'cut' or 'awk' or 'sed' are always mentioned but never using the string expression ...
-2
votes
1answer
46 views

Shellscript Looping Through All Files in a Folder

I want to write a shellscript that will loop through all the files in a folder and echo only the .sql files. Can anyone point me in the right direction? currently I am getting all the files along ...
0
votes
1answer
71 views

Docker Quickstart Terminal: cd: /u: Permission denied

I've just installed Docker for Windows. Quickstart terminal creates the 'default' vm, but then it can't access it with text: bash: cd: /u: Permission denied Looks like something went wrong... Press ...
0
votes
1answer
45 views

Can I run Powerline without Xorg

I installed powerline and its works fine in Xfce terminal. I am using ArchLinux. When I log in, pc always boot into cli mode. I like that. But in cli mode before satarting X, the bash prompt looks a ...
0
votes
1answer
35 views

Can't connect to remote machine via SSH - error: Permission denied (publickey,keyboard-interactive)

I've been trying to connect to the remote machine with the new second admin account but password was rejected. I'm very certain that I have typed the right password for the second admin account. After ...
1
vote
1answer
41 views

How can I navigate to a directory name with a special character

Normally, I'm used to navigate into directories in Linux using the cd command. Now, in a terminal, I need to get into a directory named -. I tried to navigate into the directory using cd -, but I was ...
0
votes
0answers
114 views

Merge xml files using Linux shell scripting

I have 2 files named file1.xml and file2.xml respectively. The contents of the files are: file1.xml: <EJB:Service> <EJB:ServiceId>123</EJB:ServiceId> ...
2
votes
0answers
38 views

Setting up a watchfolder

I want to make a folder that I can put any video file into and have ffmpeg catch it and spit it out as an mp4 and remove the non-mp4 file. I have the following: for f in *.*; do ffmpeg -i input ...
2
votes
1answer
35 views

Separate files by name into different folders

If I have a folder containing various files with the same pattern, for example: file1a file1b file1c file2a file2b file2c ... Is there a one-liner for separating them into folders named: ...
0
votes
1answer
20 views

Move one word backward repeatedly using ESC + B

I want to be able to move one word backward repeatedly using ESC + B on my OSX bash. The trouble is that I can just hold the ESC key and press B repeatedly in order to move repeatedly: if I don't ...
0
votes
1answer
42 views

Save shell execution output to file and display in terminal [duplicate]

I know you can save the output of executing a script/file to another file by using: ./script.sh >> script_output.log but this doesn't display the output in terminal during execution. Is there ...
0
votes
1answer
39 views

Find repeated numbered files

I have a bunch of files with names like this file_1_v4_sdk.x file_2_v1_3kl.x file_3_v1_39f.x file_3_v2_df0.x file_4_v4_f33.x file_4_v1_fks.x file_4_v5_skd.x file_5_v2_9ks.x file_6_v4_911.x ...
1
vote
0answers
70 views

“bash: gfortran: command not found” in Cygwin after Fortran installation is complete

I just installed Cygwin and am using it to run an open source software package which requires the use of a Fortran compiler. I have run setup-x86_64.exe and installed (I believe) all the Fortran ...
0
votes
1answer
76 views

How do I run a command as another user?

I’m using the following version of Linux [me@ip-99-99-99-99 myproject]$ uname -a Linux ip-99-99-99-99 99.99.99-99.99.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux ...
2
votes
3answers
46 views

Restore shopt -s nocaseglob setting to default in OS X

In trying to make Bash for OSX TAB-Auto-Completion to be Case-insensitive, I followed a suggestion to run these commands: shopt -s nocaseglob bind 'set completion-ignore-case on' How do I restore ...
0
votes
1answer
32 views

How to bash complete an alias as the command [duplicate]

I have an alias alias gi=git Unlike git, gi cannot complete on subcommands, paths, branches. How can I tell bash to "complete X as if it were Y"?
0
votes
1answer
48 views

Shell Script to pass arguments to another script

I am new to the linux and shell scripting. I have a script, which has some read commands in it. So, something like #script1.sh echo "something here" .... read var1 read var2 ... Now, i want to ...
0
votes
0answers
13 views

registering an application in the Registry/../AppPath WITH flags

What I would like to do is to have Git Bash open through Visual Basic Process.Start() with the --login -i flags already set. To do this, I realized I need to have the shell file added to the registry ...
0
votes
1answer
17 views

How to start a program on user login

On Debian Lenny with KDE. I added a command to the bottom of $HOME/.profile to open transmission so my complete .profile looks like this: (everything except the last line is default) ... # if ...
1
vote
4answers
163 views

cat all files except a select few

If there some particular syntax so that I can cat all files in a directory, except for the select ones. For eg., suppose I have ~1200 text files containing some lines, about 3 or 4 lines per file, ...
0
votes
1answer
87 views

shell environment setup for virtualenv/virtualenvwrapper

The question is about shell setup for virtualenvwrapper, an extension to virtualenv (python guide). Similar questions had been asked many times but with a lot with different answers: Environment ...
0
votes
1answer
72 views

linux command to find out if folder exists or not in a windows ftp server

I have connected a Windows server from a Linux machine via ftp. I want to find out if a particular folder exists or not in the Windows FTP server. How do i find out that using Linux shell scripting? ...
-1
votes
2answers
46 views

A bash script to call itself and return a value

I'm trying to count the number of files inside a directory while checking the sub-directories with the same script itself and sum up the results. #!/bin/bash var=0 var=$(ls -l $1 | grep "^-" | tr ...
1
vote
2answers
55 views

how to find closest folder in the command line

Suppose the command :pwd returns ~/Users/MyUser/FolderA/FolderB I want to write a script where I don't know in advance that I am in FolderB, as I can be in FolderA or even some other external ...
2
votes
1answer
60 views

Whitelisting commands a user can use with sudo

I've been attempting to set up a whitelist of commands a user can run on my system. The server I'm using is running CentOS 7. What is the syntax that should be used to only allow a certain group of ...
0
votes
0answers
37 views

How can I wrap a sensible text file with a Bash script that allows every user to grep for $USER?

So I have a file data.txt that stores user name and some piece of data, one line per user. I'd like to have a Bash script that is runable by the users and allows them to call grep -w "^$USER" ...
2
votes
0answers
39 views

Many cron -f processes on unresponsive server

My Debian server had again become unresponsive and needed to be restartet (SSH login impossible, no longer transmitted log data to another server's MySQL Database, no new FTP connections possible, but ...
1
vote
1answer
45 views

How to get csvkit to recognise long ASCII lines?

I am using Ubuntu and I downloaded this CSV file, which file tells me is encoded like: ASCII text, with very long lines, with CRLF line terminators However, when I pass csvcut -e ASCII datafile, I ...
0
votes
1answer
35 views

What does the second field in ls -l mean on OS X? What does “number of links” mean?

I'm on an OS X operating System, and I don't understand what the second field in the ls -l command is supposed to mean. Say I am inside an empty directory, and I create a single directory inside of ...
0
votes
1answer
125 views

bash - find string index position of substring

good day all I am not able to see my error, I would like to find the position of a substring "searchstring" within string "t" of a few methods I have looked at, this seems easiest and most ...
1
vote
1answer
37 views

cat file contents to temp file but file/folder doesn't exist

good day all this is part of a larger function, but I get this error and can't figure out what is the problem: script name "connected.sh" running this cat "$logfile" | grep "$searchstring" ...
1
vote
0answers
41 views

Truncated input when piping to another command in Bash in Mac OS X

I used to be able to handle piping just fine, but recently I’ve been having problems with Bash truncating output when it’s piped into another command. What could be causing this? I'm using Bash on ...
1
vote
1answer
22 views

bash/readline doesn't autocomplete directory name

I have an executable in a subdirectory of the current directory: ~ $ ls -l src/users -rwxr-xr-x 1 me users 1001K Nov 17 18:52 src/users* I try to execute it by typing sr and then clicking tab. ...
1
vote
1answer
149 views

bash - return array from function and display contents

good day all after some bash self study and expermenting, I am stuck with returning an array from a function, and for the life of me can't see my error. in short, what this should/must do is by ...
2
votes
2answers
78 views

Unbound keys in ReadLine

About using Readline with Bash: $ cat ~/.inputrc "\C-[[Z": complete-command "\C-[[23~": history-search-backward "\C-[[24~": history-search-forward Now in Gnome terminal F11 and F12 key search ...