Questions tagged [bash]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
12 views

loop through subdirectories and ffplay all mp3 files

hi i'm trying to iterate through subdirectories and ffplay all MP3s in subdirectories, but i keep having only one track playing after it stops, here is my code #!/bin/bash shopt -s globstar nullglob ...
0
votes
0answers
12 views

Joining directories, logically? [duplicate]

This is quite possibly just a silly question, and I suspect I already know the answer, but I might learn something new, so ... I recently learned about the CDPATH environment variable, which lists a ...
0
votes
1answer
12 views

AWK/SED/GREP - print M lines after the Nth occurrence of a match

I am looking to display M lines after the Nth occurrence of a match. Actually I need to do this in order to split a file containing Nth <regex> always followed by M lines into Nth different ...
0
votes
1answer
30 views

zsh: permission denied: /Users/iprasanna/.bash_profile

I am trying to run the following to set env, but I can not: echo 'export ethereum_home=/Users/mattthomas/ethereum' >>~/.bash_profile Permissions for .bash_profile: -rw-r--r-- 1 root staff ...
0
votes
1answer
13 views

bash script to switch to random vpn profile every hour

i have a namecheap paid vpn service with hundreds of profiles (ovpn conf files), each allowing me to have an IP address from a different country. i would like do switch between those profiles every ...
1
vote
0answers
60 views

How might a bash.exe appear in system32 of Windows 10? [closed]

I just discovered that running bash on one of my Windows machines launches a bash terminal. Apparently this is running a bash.exe in Windows/system32. I'm assuming Win10 does not by default come with ...
0
votes
0answers
11 views

Open PHP Storm on bash command-line without output

Since hours I'm trying to run my phpstorm from commandline, without having any output at all. Reason: Every day when I come to work, I have multiple tools to start... 2 different vagrant machines, ...
2
votes
1answer
53 views

Setting background image in Git Bash with Windows Terminal

I have Git Bash running in my Windows Terminal, but I have trouble setting the background image, which is only visible in the right strip of the terminal window (it's cropped, not squished): At first,...
1
vote
0answers
26 views
+50

Shell set to bash but running zsh

I tried out zsh, but decided to revert to bash because it's what I'm used to. I've set my "Login shell" back to /bin/bash in System Preferences > Users & Groups > Advanced options ...
0
votes
0answers
14 views

bash: /home/user/.rvm/scripts/initialize: No such file or directory

I deleted rvm using rvm implode and then cd'ed into a project file and it gave me this error bash: /home/user/.rvm/scripts/initialize: No such file or directory bash: /home/user/.rvm/scripts/hook: No ...
2
votes
1answer
45 views

not able to execute ./sage

I've downloaded the precompiled binary for sagemath 9.1(sage-9.1-Ubuntu_18.04-x86_64.tar.bz2), I'm on ubuntu 20.04. After extracting the file when I run ./sage in the terminal it says bash: ./sage: ...
0
votes
1answer
88 views

Using Shell date command on macOS

I'm trying to convert a date string into epoch time in bash on macOS. I understand that the Mac's version of date is subtly different from on Linux - and I can't work out where I'm going wrong. Here's ...
2
votes
2answers
39 views

options for [for /f “usebackq” %%f in (`find “” path`) do] sentence in batch

I symplified my problem: @echo off set res= for /f "usebackq" %%f in (`find "a" list.txt`) do set res=%%f echo %res% pause>nul and that things.txt file in the code is like: ...
1
vote
0answers
17 views

window batch) manipulating 'for /f “usebackq” %%f in (`find “str” path`)' sentence [duplicate]

I symplified the problem here: @echo off set res= echo 'na': for /f "usebackq" %%f in (`find "na" things.txt`) do set res=%%f echo %res% pause>nul and that things.txt file ...
0
votes
0answers
51 views

Macos/Linux ping command pinging incorrect IP address

I would like to get the ip address of this (data.alpaca.markets) url. When I use the ping command on Macos, this is the ip address that it returns: 35.186.171.205. I navigated to the IP address only ...
0
votes
2answers
51 views

How to find and replace in linux on a large file?

Oh, hi; So I've got this big json file and I'm trying to find and replace a few things but when I've used sed I get an error and I need a sed or awk string to find and replace it, without getting an ...
5
votes
2answers
2k views

Why can't the wildcard expression be used as a non-root user?

I am using a wildcard expression to match a filename. This is what happens with a normal, non-root user: debian@MiWiFi-R3-srv:~$ sudo ls /var/log/apache2/*[0-9].gz ls: cannot access '/var/log/apache2/...
0
votes
1answer
19 views

How can I tell systemd to run a shell script 1 second before the end of every minute

I know how to run a job every minute or every 59 seconds, but what I need here is for the script to run 1 second before the end of every minute i.e: 7:05:59 (7am 5 minutes 59 seconds) 7:06:59 (7am 6 ...
0
votes
0answers
30 views

Not able to execute mycommand.sh as myuser without giving password whenever I run the command as myuser/root/anyotheruser

In /etc/sudoers.d/app-sudo file contains the below content. ALL ALL=(myuser) NOPASSWD: /export/home/subhajit/mycommand.sh mycommand.py contains a command as below which should run as myuser: sudo ...
0
votes
1answer
32 views

ImageMagick - How to avoid overwriting existing files with mogrify?

I have these files under ./: a.jpg b.jpg 256/a.jpg I'm running this command to convert files to 256px: mogrify -path ./256/ -resize 256x256 *.jpg But this command always overrides the existing files ...
0
votes
0answers
28 views

Reset Bash terminal output to console after directing output to file

I have a script with output I want to capture. make some_args 2>../error-compile I believe the error capture is working fine. Problem is that it is an hours long compile with an install so I have ...
0
votes
0answers
10 views

VNC over Unix Domain Socket won't start

I'm trying to set up a VNC server that will listen on a unix domain socket. but it fails without a clear error message. My end goal is to connect Websockify/NoVNC to the socket to avoid the VNC port ...
0
votes
0answers
10 views

Passing variables values to sftp hierdoc

This one is working: sftp ora@rac2:/DEV/IN <<EOL_SFTP **mput *_$EXTRACT_$TMS.zip** bye EOL_SFTP but i wish to use more complicated pattern: mput $TEST_NR_*_$ENV_*_$EXTRACT_$TMS.zip and it don't ...
2
votes
2answers
122 views

How can I automatically download and archive my own YouTube videos? [closed]

I want to download all my YouTube videos (potentially hundreds or thousands, including live streams). I have MANY private YouTube videos that are really for my own personal usage. I am beginning to ...
1
vote
1answer
47 views

What is the zsh equivalent of bash's “command” command?

I've overwritten my cd command with pushd so I don't have to remember to use pushd and can easily get back to where I've been. Now I want to use the actual cd command. In bash, I would use command cd ...
0
votes
1answer
26 views

Issues installing macOS Catalina in virtualbox on macOS High Sierra host

I was trying to install macOS Catalina on latest version of VirtualBox, hosting it on a Mac running macOS High Sierra (10.13.6). I was searching, and I found this blog post: “Install and run macOS ...
0
votes
0answers
18 views

How to get the display screen my shell is currently on?

I have 2 screens, one above the other. I'm trying to use a shell command line that takes the position where to start, and another option = the screen. The problem is that this programs calculates its ...
0
votes
2answers
32 views

Problems deleting files, with names grep 'ed

A text file contains a a list of sha5 hashes and the files. Those should be deleted. looking like this: 01115896a225d60b6e8b833b10955d2c "./path/to file/file-name" ...
0
votes
1answer
26 views

reverse Google image search from the CLI

Is it possible to do a reverse Google image search from the command line or a thunar custom action that only appears for images?
0
votes
0answers
27 views

Weird behavor of which on Mac Mojave [duplicate]

I have a university issued Mac on which I do not have root access. I noticed a weird problem in the behavior of which and presumably lstat. I want to know if this is Mac thing, or a setting changed by ...
1
vote
1answer
15 views

Bash PS1 dissappears after history browsing [duplicate]

I have been configuring my new fresh Arch installation. I just finished with my PS1 in Bash and realized about an error I do not know how to solve. This is the code: PS1='\n\[\e[30;44m \u@\h \]\[\e[34;...
0
votes
1answer
54 views

Bash script to compare df -h free disk space to aria2c file size using sed

I am trying to compare the output of aria2c -S with df -h. For example aria2c -S ../Radio* |grep 'Total Length' gives: Total Length: 12GiB (13,191,069,983) and I want to compare with df -H / | tail -1 ...
0
votes
0answers
21 views

having trouble calling functions in my code

I'm new to bash scripting and in this file I'm trying to clean up my code. The first one works perfectly. In the second one, I simply put code into two functions and call them within the case and if ...
1
vote
1answer
23 views

Is there any way to enable a backup of the current directory to take place when an rm command is issued?

I know how dangerous rm can be, and I'm unfortunately not a very responsible person at all. I know that I need to learn, but while I'm in the process, I need some help. Is there any way to create a ...
0
votes
1answer
24 views

OSX terminal - change back to bash

My terminal is using zsh (.zshrc) I don't remember how that happened. How can I go back to bash to use .bash_profile instead?
0
votes
1answer
38 views

Being selective about imported variables in BASH script

I have three bash scripts. w.txt, t.txt and d.txt. w.txt: #!/bin/bash wtimes=( 8:20 9:30 10:11 ) wtimef=( 10:10 11:20 13:30 ) echo $wtimes >> d.txt t.txt #!/bin/bash . ./w.txt echo "${...
0
votes
1answer
54 views

bash zip by file permissions

I have a "zipup.sh" routine that backs up to one zip file. It includs file paths of all my programs in several different Linux folders within my home directories with an -mtime -1. At times, ...
1
vote
1answer
29 views

How to replace dmenu with fzf as application launcher in suckless dwm

I am using dwm with dmenu but am trying to replace dmenu for fzf as an application launcher. I have looked at examples in fzf wiki but did not find information about a particular problem. The problem ...
1
vote
0answers
36 views

Permission Denied While Running Script

I am attempting to run a script from the shairport-sync service with this command: run_this_after_play_ends = "/home/pi/Watson/testmicend.sh" /home/pi/Watson/testmicend.sh: #!/bin/bash ...
0
votes
1answer
24 views

how can I show users who has only one session opened?

How do i find users who has only one session opened? I know I can find who has multiple session opened using: who | cut -d " " -f 1 | uniq -d
0
votes
0answers
26 views

Installing Yum via SSH on a server hosted by GoDaddy

The problem is that GoDaddy's RedHat Linux hosting fails to come with either apt-get or yum pre-installed for package management. I need either of those to get started on installing java and other ...
1
vote
1answer
23 views

Remove all characters after first non-numeric character using sed or awk

TL;DR: How can I create an expression using either sed or awk that will remove all characters after (and including) the first character that is not either numeric (i.e. [0-9]) or a period (.). I've ...
0
votes
0answers
14 views

Pass two password to su commands

I am trying to run shell comment through PHP scripts. I want to first su into a user then run a sudo command. I tried: echo mypassword | (su -c "sudo reboot" user2) It doesn't work because ...
0
votes
0answers
17 views

Double characters returned by redirection to file using macOS Terminal

When I run this command from the Terminal some words of the contents of the resulting file contain double characters. man clear > clear.txt Result file opened with TextEdit: clear(1) ...
0
votes
1answer
23 views

Bash access overwritten shell commands

This is more for my edification than a problem I'm experiencing. In my .bashrc I've overwritten cd with a function that runs pushd so I can easily pop the stack without thinking about it. cd() { [...
0
votes
0answers
49 views

Enable gnome-terminal hotkeys depending on the vi mode in the terminal

I have recently discovered that it is possible to enable vim bindings in the gnome-terminal with: set -o vi Now I would like to know whether it is possible to also enable hotkeys for the terminal ...
1
vote
2answers
81 views

Regex to substitute character with numbers around it in filenames with rename utility (perl based)

I would like to rename files that have the following format: somethingblabla15T06:58_31+0000somethingblabla.bla THe new name should be somethingblabla15T06:58:31+0000somethingblabla.bla So the _ ...
0
votes
0answers
31 views

Bash Script Mistake - All files/directories available ftp

My script worked but I seem to have given access to all files/directories on my server. (I also posted this on the Ask Ubuntu. I hope it's not taboo to post on more than one StackExchange site.) I am ...
0
votes
1answer
38 views

Can I change my terminal environment to bash shell using a script and then execute other commands after changing the shell in the same script?

I am trying to write a script that sets my main terminal to use bash shell. I know the #!/bin/bash will call all the commands in the script to be run with the bash shell but what I want is a script ...
0
votes
0answers
73 views

Running command-line tools giving python3 bad interpreter, no such file or directory error

I have two versions of python installed on a server: /usr/local/bin/python3 (version 3.6.3) /home/ubuntu/miniconda2/bin/python (version 2.7.15) Earlier today I removed python version 3.6.3 and 3.4.0 ...

1
2 3 4 5
203