Questions tagged as ['bash']

Bash (Bourne-Again SHell), is the shell used in Ubuntu's command-line interface by default.
Score: 0
alonewolf avatar
How can I convert a Windows path to Unix?
cn flag

I want to create a program on Ubunut (WSL) that creates Folders and Text-documents. The user can type in a path, since Windows uses another path system we can’t just copy and paste. For convenience I want that the Windows path is automatically converted to a Unix path. Via the:

read -r path;

i ready the path in. How can I realize this, I tried multiple times. I also searched for answers in the inter ...

Score: 0
Problem with running related scripts via systemd
my flag

I tried to run three related script automatically (launcher,set-app,checkapp.py) using systemd timer and systemd service, first script check the python script (gui app) if he already running, after that he restart the python gui app, my problem is when i trying to run systemd service, it close the gui app

this is the first script (launcher):

#!/bin/bash
/usr/share/checkapp/set-app 
exit 0

and this is t ...

Score: 0
Dáire Fagan avatar
Force separate Mullvad VPN settings per user?
us flag

I would prefer that I was able to autoconnect to a different server for each of two users with Mullvad VPN.

What I have tried:

With crontab -u <username> -e for each user I added a single line from the following unique to each:

@reboot mullvad relay set location ie dub
@reboot mullvad relay set location uk lon

but both users, even with different crontabs, still connected to the same VPN.

Next I ...

Score: 0
jmthecillo avatar
Ubuntu bash scripting display in browser
kr flag

Hi I am new in bash scripting. Is it posible to display the bash script in the browser. I have a script to delete files in the server. My problem is i need to customized the display in the browser for adding a search field and submit button. If the client enter a file then submit. It will call the bash script which is delete a file.

Score: 0
Anonymous shooter avatar
Install apache2 on ubuntu aws EC2 instance via scripit (useing terraform)
am flag

I try to create an ubuntu instance via terraform after install I want to execute the script which is referred to install apache2 here is my script

app1-install.sh

#! /bin/bash
sudo apt update
sudo apt install apache2-bin
# sudo systemctl enable apache2
# sudo service apache2 start  
sudo echo '<h1>Welcome to my terraform demo - APP-1</h1>' | sudo tee /var/www/html/index.html
sudo mkdir /va ...
Score: 0
Nicholas Saunders avatar
how to use testng directly from bash?
mx flag

I'm not seeing why java cannot find App as it's explicitly added to the classpath:

nicholas@mordor:~$ 
nicholas@mordor:~$ java -cp /usr/share/maven-repo/org/testng/testng/debian/testng-debian.jar:/home/nicholas/NetbeansProjects/testng_gradle/src/main/java/testng_gradle/App /home/nicholas/NetBeansProjects/testng_gradle/app/src/test/java/testng_gradle/AppTest.java /home/Nicholas/NetbeansProjects/tes ...
Score: 0
noobplusplus avatar
ubuntu 21.04: /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
ph flag

I have bought a windows laptop yesterday, I installed fresh ubuntu 21.04. The I installed VS code from Ubuntu Software. Now the sudo command doesn't work in vscode integrated bash terminal. I get following error message:

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

but sudo works perfectly fine in ubuntu b ...

Score: 0
Can you install software and tools using a script?
ng flag

I'm new to Linux but I saw someone run a script and his user profile, tools like NodeJS, VSCode, the Chrome browser etc were installed on that new machine without him doing it one by one.

How could I do something like this in ubuntu?

Score: 0
Logan Lee avatar
How to avoid race condition when mounting, copying files into, and umounting images
dk flag

This script creates ten image files and copy over file(s) to them.

#!/bin/bash
# script to create multiple floppy images for installing hwp30
#+on virtualbox.

# umount image in case mounted
sudo umount /media/floppy

# create ten blank 2.88mb images.
#+then mount each image and copy over file(s).
for n in {1..10}; do
    mkfs.msdos -C "hwp30-${n}.img" 2880
    sudo mount -o loop "hwp30-${n}.img" /me ...
Score: 0
Sayan Dey avatar
login shell check is not working in .profile
vn flag

Ubuntu 20.04, 5.8.0-63-generic, gnome-shell, gdm3

My login shell is set to /bin/sh

and I have this line in my $HOME/.profile file:

shopt -q login_shell > /dev/null 2>&1 || export SHELL=/bin/zsh

Now from my understanding export SHELL=/bin/zsh should not be executed on login right? because it is a login shell so shopt -q login_shell > /dev/null 2>&1 is True.

But I am getting $SHELL as / ...

Score: 0
Sandeep Thakur avatar
-bash: /etc/profile: Input/output error
in flag

When I was trying to connect ssh to my remote machine after ssh and enter password it give -bash: /etc/profile: Input/output error some time but after hard reboot I'm able to ssh my remote machine is there any hardware issue or else and how to permanent resolve this issue

Score: 0
mohamed rabiaa avatar
why can't I open my Android Studio project on XUbuntu?
cn flag

I am an Android developer and I use Android studio to build apps, I am also newbie in Linux and I have installed Xubuntu since 2 days, every time I try to open a project (after restaring my pc) the path of the project is not recognizable by Xubuntu and Android Studio gives me a dialog with this error message: "The path /media/mohamed/LocalDisk/AndroidProjects/MyChatApp doesn't exist. if it is on a remov ...

Score: 0
Can you include logic in youtube-dl's --output parameter?
ca flag

For youtube-dl, I have a script that has an --output value that looks like:

"%(uploader)s/%(playlist_title)s/%(upload_date)s - %(title)s/%(upload_date)s - %(title)s [%(id)s].%(ext)s"

Sometimes I download individual videos, not playlists or channels; I'd like to use the same script. Is there a way to put an if statement or some other logical expression to say "ignore the playlist title if there isn't one" ...

Score: 1
Will H avatar
What am i doing wrong in Conda?
in flag

I am a first time user of of Anaconda & Miniconda suite and I have been having problems running code using it. Every time I try to run a python script in Anaconda or miniconda it comes up with this issue:

/miniconda3/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/anaconda3/lib/libtinfo.so.6: no version information available (required by /bin/bash)

I have looked in al ...

Score: 0
Ihos avatar
modify specific columns based on another column by using awk and gsub
bt flag

I have a file (file1) with millions of rows and columns. An example of data are:

"col1","col2","col3","col4","col5","col6"
"AAA",0,5,10,"BGB",50
"BBB",4,7,10,"BFD",76
"AAA",15,0,0,"BGB",20
"AAA",10,13,10,"DDD",23

I want to find all lines that have AAA in col1 and then get all the rows that have BGB in col5. And finally, decrease 50% of every value in col2, col3, col4, and col6 (Ignore if cell values a ...

Score: 0
user10736820 avatar
i have installed cmake to /usr/local but when i use it ,return
cn flag

bash cmake-3.18.6-Linux-x86_64.sh --skip-license --prefix=/usr/local

i use cmake --version

return

bash: /usr/bin/cmake: No such file or directory
Score: -4
Laurel avatar
Bash autocompletion
us flag

When I'm typing in the bash, something is trying to autocomplete my input in a rather weird way, see picture attached. I'm not pressing tab or something, just trying to type like "describe table" or "select"

What's causing it? How to unmount?

Screenshot #1

Screenshot #2

The previous user denies installing any utils of the kind

Score: 1
lemnlover avatar
Bash Script commands inside a program
gq flag

Please excuse me if this is too simple for you, but I really did my search before posting this question. I am trying to create my first bash script for auto connecting on my softether vpn. To manually connect I follow these steps;

sudo ./vpnclient start
sudo ./vpncmd

then it asks me a question of selections from 1 to 3, I pick 2 and hit enter. Then it asks me something else and I just hit enter. Then; ...

Score: 0
Cas avatar
Is it possible to execute a script with only editing/remove/making files
in flag
Cas

Just curious,

Would you be able to run a script (let's say test.sh) without every doing ./test.sh? You can only edit/make/remove files. A few things I thought about:

  • crontab, and then add a line with the current "time + 1 minute" and the script. But crontab doesn't have a file at a location that you can edit, instead you have to edit it with crontab -e which is a command, so this one isn't an option.
Score: 0
KneadToKnow avatar
Bash rsync script won't complete on large backups
us flag

Over the last year or so, I've be trying to learn bash scripting on Ubuntu (one 20.04 LTS box and one 21.04). I feel that my skills have been progressing nicely, but I'm at my wits end with one particular backup script I've written.

Long story short, if the backup script is only trying to backup my /home directory, it runs smoothly beginning to end, but if it is trying to backup my / directory, i ...

Score: 0
Andrzej Więcławski avatar
PostgresSQL dump version recognition Bash script
de flag

I often recreate variuos customer databases on local dockers to test new ERP functionalities in the development environment So, PostgreSQL dump file usually starts with:

--
-- PostgreSQL database dump
--

-- Dumped from database version 13.3 (Ubuntu 13.3-1.pgdg20.04+1)
-- Dumped by pg_dump version 13.3 (Debian 13.3-1.pgdg100+1)
...

Thats why my bash script 'restorefromdump.sh' (building temporary dock ...

Score: 0
Marchan4 avatar
I can't verify that the environment variable “SECRET_KEY_BASE” is properly set in Linux
cn flag

My ruby ​​version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5.

I use macOS Big Sur(version 11.4) and the text editor "Atom".

I'm planning to release my Rails application with the URL of HEROKU(example. https://[My APP Name].herokuapp.com).

I ran the following command.

$ heroku open

The fo ...

Score: 0
Kong avatar
How to run several shell scripts but terminate all of them if one encounters an error / does not terminate successfully?
jp flag

I have a shell script that runs several other shell scripts in parallel e.g. ./run_all.sh contains

./run1.sh &
./run2.sh &
./run3.sh &

wait
echo "All 3 complete"

How can I terminate all processes if one of them exits due to an error etc? The && requires each script to terminate successfully but it runs sequentially.

Score: 0
Highlander avatar
bash profile not opening nano editor
kr flag

im wondering why my Ubuntu 18.04 (LTS) x64 is unresposive to sudo commands.

im trying to configure env variables for GO and my command to get in to nano is nano ~/.zshrc

nothing happens and doesnt ask me to log in. Has anyone had this before?

Score: 1
partizanos avatar
Bash tab not autocompleting node_module scoped folders starting with @ (at character)
in flag

I have the following weird behavior the following folder exists @fortawesome

But when I press

cd tabkey

none of the folders starting with "@" appears. Why does this happen/ how can I investigate it more?

Score: 0
Grzegorz Michalak avatar
How to display size of installed hard drives
in flag

I want to write simple linux script which will display what are the real size of installed hard drive. If there is 128GB SSD, lsblk shows less than 128. I need to check the real size of memory and print it like this: 128GB installed = script gives output

128

If there are two hard drives installed, it gives output

128/512

It should work on both sata and nvme drives

Score: 0
JConstantine avatar
How can I copy/paste from Hyper-V Windows 10 into Ubuntu 20.04 LTS Server bash?
sy flag

I have Ubuntu Server installed on a Hyper-V virtual machine and would like to be able to copy/paste from my Windows 10 machine into the Ubuntu Server's command line. Is it possible? Any help is appreciated.

Score: 0
Bad Day of the Month error in simple crontab
br flag

I have a script that should run every 4 hours. */240 **** ./autorun.sh

It's my first attempt at creating a crontab and it seemed easy enough, obviously somethings wrong but I don't see why and the error message doesn't make sense to me. Any help is appreciated.

This is the output after saving my first crontab:

crontab: installing new crontab "/tmp/crontab.YYOJBl/crontab":23: bad day-of-month errors i ...

Score: 0
Avihai avatar
Bash script in Cron not running Python Script on Ubuntu 20.04.2 LTS
cl flag

I have an Ubuntu 20.04.2 LTS server which I run few python scripts.

I created a cronjob to run a bash script to check and see if my python script is running:

#!/bin/sh
#!/bin/python2.7


SERVICE="start_server.py"
if ps -ef | grep "$SERVICE" | grep -v grep >/dev/null
then
    echo "start_server.py is running" >> /home/ubuntu/mislaka/script_log.log
else
        python2.7 /home/ubuntu/mislaka/st ...
Score: 1
Andrzej Więcławski avatar
Conky warning: invalid head index
de flag

my Conky still echoes 'invalid head index' during console tests.

Generally, It starts without any problems with my OS: 5.8.0-63-generic #71~20.04.1-Ubuntu SMP Thu Jul 15 17:46:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux, effectively executing bash file '~/conkystartup.sh' at every startup:

#!/bin/bash
sleep 15
dir=~/.config/conky
cnf=${dir}/conky.conf
log=${dir}/conky.log
dat=$(date +%x-%X)
# execute co ...