Questions tagged [bash]

51259 questions
1

votes
0

answer
93

Views

Set maximum time for download with wget recursive

I am crawling multiple webpages with wget. However with some of then it would keep downloading files forever, so I run it from a bash script which kills it 10 minutes after start. However wget does link conversion at last (--convert-links) and if I kill it the files would have the original links an...
NeDark
1

votes
1

answer
28

Views

Generating new files from a template by finding and replacing, with bash

I have a template LaTeX file containing a counter (called 'Contador') inside the text, in a line such as \addplot[] table[]{figure-contador.csv} That counter allows me to include the data from a lot of figures coded in CSV files. The file is named test.tex. I want to generate 100 new files from...
Miley
1

votes
1

answer
42

Views

PIP is linked only to system environment

I'm using pyenv-virtualenv on Ubuntu 16.04 LTS. While I was installing imblearn package for my virtualenv using Python 3.5, I realized it was being installed on system environment which uses Python 2.7. I checked with pyenv version but it clearly returned that I was on my virtualenv. I opened a Pyth...
user8397275
1

votes
0

answer
31

Views

How can file writes with NodeJS on Docker be inconsistent?

A while back I've created some feed fetching & processing scripts with NodeJS for an application I'm working on. I've been running this script on my local machine (OSX) manually for a while and momentarily I'm working on having a job do this. I figured I'd go with a Docker droplet ($5/mo) on Digital...
nicoes
0

votes
0

answer
10

Views

Bash with few commands, whitelisting few built-in commands

Trying to open a bash shell with limited command capability. Tried command line options like -r restriction but doesn't give intended result. Also tried shopt & unset commands. bash --noprofile --noediting --verbose --version --init-file test.sh unset ls shopt -u -o history Start a bash shell with...
Kunal G
0

votes
0

answer
6

Views

bash: ambiguous redirect when using curly-bracket globbing in process substitution

The following contrived example works: $ while read -r line; do echo $line; done <
bmatcuk
1

votes
0

answer
223

Views

xdotool type takes ages and causes entire desktop to freeze

I've been using xdotool type in the past only to type a shrugface on shortcut using xdotool type '¯\_(ツ)_/¯'. That works, but always takes quite a long time and causes the entire desktop to freeze (entirely, not just input) for a few seconds. Didn't bother me much though. Now I need a way to rea...
confetti
1

votes
1

answer
45

Views

Unable to do a correct match

Hey guys I am working on a project in which, I need to store device names in the file and then I am trying to find that name using cat file | grep device and if that name exists i am trying to print the yes else no.I did this via the following code but I am unable to achieve the expected result, pl...
Dixon
1

votes
0

answer
147

Views

How to avoid zombie process from crond ( crond -l 9 )

My system based on Linux ( 3.12.14 ), I could see Zombie process [ sh ] creates for very frequently. I have found that (crond -l 9) which was parent process of zombie. I confirmed that, always crond -l 9 was parent process. As per crontab (crontab -l), lot of scripts are running based on configura...
mselvara1982
1

votes
1

answer
44

Views

BASH - Run 6 scripts but only 3 togheter at a time and if one is finished then start with another [duplicate]

This question already has an answer here: bash script to run a constant number of jobs in the background 3 answers . I have a simple bash script where i run 3 at the same time and when they are done they start with the next 3 like this: command1 & command2 & command3 & wait command4 & command5 & co...
1

votes
0

answer
263

Views

vim: bad auto-indentation for bash

I'd like to have my bash scripts auto-indented within vim (using '='). If I take the script: #!/bin/bash if :; then { echo 1 echo 2 } fi the command 'gg=G' will indent everything fine. But if I write it as: #!/bin/bash :&&{ echo 1 echo 2 } 'gg=G' will only indent the first line after '{', as shown....
Gerald Schade
1

votes
0

answer
907

Views

Get mandatory arguments for getopts

I want to make some flags and their corresponding arguments as mandatory in getopts. The way I am doing so is by checking if the argument was passed or not for the mandatory flag, like so (flag for -i and it's argument should be mandatory): In test.sh: while getopts 'i:n:d:r:p:s:l:' opt; do case $op...
swa_mi
1

votes
1

answer
39

Views

Want to write customized error and output function in shell script

I want to pass the standard error and standard output to userdefined function to write the custom logs OutputLogFile='OutputLogFilepath' ErrorLogFile='ErrorLogfilePath' //user defined function OutputLog() { echo $(DateTimeForLog)-$ScriptName-”information”-$1 >> $StdOutPutlogFile }...
Suganya
1

votes
2

answer
66

Views

awk commands in file gives error when executed in loop

file_data.txt 73|8|42.320000|1559260800000|1|9667|0.00|42.320000||1485613678440| 153|8|35.680000|1559260800000|1|10899|0.00|35.680000||1482480306523| 2503|8|93.390000|1559260800000|1|6106|0.00|93.390000||1484304241803| 2672|8|49.990000|1559260800000|1|7754|0.00|49.990000||1482064270543| AWK_COMMANDS...
Ashish
1

votes
0

answer
80

Views

How to store backslash+dollar-sign (“/$”) in R?

I'm trying to generate a script using R. I want the script to include the following command: GPU0=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk 'NR==1{print$1/100}') If i want to do this in the terminal, I would execute the following command: echo 'GPU0=\$(nvidia-smi -...
clee165
1

votes
0

answer
460

Views

How to access folders on Desktop from Git Bash

On Windows, I have several folders(one of which is MyFolder) on the Desktop which I would like to open from Git Bash. However, when I run ls /c/Users/myname/Desktop I get only: desktop.ini What is desktop.ini and why does it appear instead of the folders that I have on my Desktop? Also, if I search...
octavian
1

votes
1

answer
52

Views

Bash Script Unstable Result

I have bash script and I put in the crontab. It runs every 10 minutes. When I run it manually, it gives perfect results. It creates '.tmp' files and these '.tmp' files are not empty, but Crontab results are not as I expected. it only creates '.tmp' files. Contents of '.tmp' files are empty. In this...
Umut TEKİN
1

votes
1

answer
236

Views

Git objects not accessible when using pre-receive hook in Bitbucket

I'm struggling to write a pre-receive hook which should verify push basing on existence of marker file. But newref populated by script is pointing into nowhere. I can`t get any data to validate getting: remote: fatal: bad object 3bb1ab6de84c324cd2fb0a7961bd5afccfd77d55 I`m trying to acquire data by:...
Szymon Masłowski
1

votes
0

answer
39

Views

automatic launching of tomcat script in ec2

i am trying to launch apahe tomcat automatically when the system boots in suse enterprise linux i have installed apache tomcat8 in suse enterprise linux i have attached the script in bash file i have edited the path in catalina also my 8080 port is working fine when i launch manually using sh startu...
Imran Sharief
1

votes
0

answer
65

Views

Error occuring during squashing the commits

While squashing the commits, I used the command $ git rebase -i master. Also I have specified the text editor to be Notepad ++ and used the command $ git config --global core.editor ''C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession'. I have a 32-bit processor as I am working with my...
Mridul Birla
1

votes
2

answer
41

Views

Sed append file is possibile use $?

I have this code: sed -i -e '$a\ persist.sys.timezone=Europe/Rome \ ro.miui.region=IT \ ro.miui.cust_variant=it \ ro.product.locale.language=it \ ro.product.locale.region=IT \ ro.product.mod_device=$DEVICE_NAME_miuita_global \ ro.miui.mcc=9998 \ ro.miui.mnc=9999 \ net.dns2=8.8.4.4' $BUILDPROP' He wo...
ale8530
1

votes
1

answer
296

Views

Run Gradle tasks from Intellij

I normally run Gradle tasks (xx.sh files) in cygwin and am wondering if I can run them from my IDE, Intellij. I have installed the BashSupport plugin, but have no idea how to create a bash launch configuration. A kind, step-by-step instruction would be appreciated since I am super new. Also, can som...
momo
1

votes
1

answer
31

Views

Bash Regular expression for validating user accounts on Linux

Looking for a simpler way to validate a user is requesting a password change for an account that is local and its a valid user ID format. Valid user ID format is - ^[^a-zA-Z]*[a-zA-Z][^a-zA-Z]*t.* With the first character being upper or lowercase letter followed by the letter t followed by 4 alphanu...
LearnToBeBetter
1

votes
1

answer
58

Views

How to read/search specific content in a webpage using shell scripting

I'm a beginner in shell scripting. I'm trying to write a script in which a part of it involves reading the value from a webpage. In this case, The shell script tries to fetch the IMDB rating of a movie by going to the movie's IMDB page. Can someone suggest me how i can achieve this & also what are...
Ravi Kiran
1

votes
1

answer
50

Views

Maven Build stuck at Creating Spec file

I've been trying to build the kylo (ver 0.8.4) project using maven on my windows machine, using the new bash feature, and following the instructions on the dev docs site. I'm running into this situation where there's a spec file being created, and its been stuck at that message for the last hour. I'...
PapaJer
1

votes
1

answer
54

Views

Unexpected Shell Script errors [duplicate]

This question already has an answer here: Why would a correct shell script give a wrapped/truncated/corrupted error message? [duplicate] 1 answer I am having errors where I am putting in code that should be working fine into a shell file and when I run it, it fails to run correctly. The error I am...
Danny Franklin
1

votes
0

answer
19

Views

Customizing build process in sencha

I'd like to have a build script showing just warnings and errors and then start up the web server, something like this: sencha app clean then app refresh then app build then web start The problem is that it will start up the web server even if the build fails, and there is a lot of INFO output. Is t...
Buddy
1

votes
1

answer
632

Views

Setting user and password for Proxy in Ubuntu

Is there a way to configure Ubuntu proxy with a script so that web browser wont ask for username/password? I'm trying to change dynamically my proxy and I would like my web browser to follow my Ubuntu configuration. -> Chrome and Firefox keep asking for authentication. Here is my script #!/bin/bash...
SimonR
1

votes
1

answer
27

Views

NetBeans: Use environment from .bash_profile when running Maven commands

I have a .bash_profile with environment variables I want my IDE, NetBeans, to see during execution but doesn't seem to work. Any hints on how to get the IDE to see this?
javydreamercsw
1

votes
1

answer
164

Views

Bash missing all shell commands

I'm trying to convert by boyfriend's old computer into a development environment because mine broke and I can't afford a new one, but it seems to be missing damn near every shell command I'm used to. It doesn't have ls even! The help command gives me this: bash-4.4$ help GNU bash, version 4.4.12(1)...
Andrea McKenzie
1

votes
1

answer
55

Views

Check if an argument passed to a bash script is a file of a certain extension

I would like to check if the number of command line arguments passed to a bash script equals to one the argument points to an existing file the argument ends with .epub (in other words, the file has .epub extension) I have already dealt with the first and second requirement but I cannot deal with th...
menteith
1

votes
1

answer
62

Views

Change the exit code in cash of error message

AWS cli returns this error in case the stack already exists and no update must be executed. An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed. What I'm trying to achieve is to have an exit code equal to 0 ONLY in the case that I have that mess...
Mazzy
1

votes
0

answer
121

Views

port exclude pattern from inotifywait to fswatch

So I have this regex exclude pattern which works excellent with inotifywait on Linux: .*\.\w+\.\w{6} Now I want to port it to fswatch on macos and use with -e or -Ee flag. What have I tried so far without any luck: -e '.*\.\w+\.\w{6}' -Ee '.*\.[[:alpha:]]+\.[[:alpha:]]{6}' -e '.*\..+\..{6}' # not ex...
valignatev
1

votes
1

answer
46

Views

Bash: Appending different strings to specific lines in a file

let's say I have a file that looks like this: The Way Direct 5.0 0.0 3.0 2.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 2.0 3.0 4.0 6.0 0.000 1.000 2.000 1.0 2.0 3.0 4.0 5.0 6.0 3.0 2.0 0.0 I'd like to change this such that it looks like this: The Way Direct 5.0 0.0 3.0 U 2.0 0.0 0.0 U 0.0 0.0 1.0 U 0.0 0.0 2.0 U...
J. P.
1

votes
0

answer
49

Views

Count lines of code by user.email in a git repository

In a git repository, how do I count the lines of code written by an author based on his/her user.email not his/her user.name
toandv
1

votes
0

answer
62

Views

Bash script Indentation in Brackets

I tried multiple Brackets indentation extensions such as the one suggested here, but they do not seem to work properly for Bash. Is there any extension available for Bash indentation?
João Matos
1

votes
0

answer
19

Views

What exactly could be the reason that my .htaccess file disturbs my script (because of redirecting)?

I am programming a php model-view-controller. Basic structure: mvc | |app | |_ models | |_ views | |_ controllers | |web |_index.php |_css |_js ... As so I use my .htaccess file for redirecting the url: RewriteEngine On RewriteBase /mvc/web/ # Let any content of web be shown (css, fonts, images,...
po0l
1

votes
0

answer
36

Views

gitlab Custom hook can't CD into Virtualbox share mount folder

I have gitlab running on a virtual machine (Ubuntu 14.04) on an Ubuntu 16.04 host. I have shared a folder on the host (permanent, automount & full access) I have set up a global custom hook which I have verified on a standard folder with permissions set to user git and group git and the custom hoo...
mbenson
1

votes
1

answer
58

Views

Run process and suspend it while Internet is down, continue when up, on loop

I have a command that is overly sensitive to timeouts, and a shitty Internet connection that gives me multi-second periods of no connection that are just frequent enough to cause that command to fail. I would like a Bash script of the form: tubeify -t 100ms -- /usr/bin/somecommand with its arguments...
Sai
1

votes
0

answer
84

Views

git rebase randomly need to be run twice

I'm facing a weird bug on my git bash for windows since the year has started: I randomly have some commands like git rebase that seem to skip a parameter once or twice and need to be run multiple times before actually doing what I want. Example: 02:56:30 (release/1.21.0) /d/Repositories/Git/X $ git...
Eregrith

View additional questions