Questions tagged [bash]
Bash (Bourne-Again SHell), is the default interactive user shell used in Ubuntu. Use this tag for questions specific to Bash, as opposed to generic POSIX shells.
11,214
questions
1
vote
0
answers
2k
views
How to convert all mp3 audio in a folder to 8d or 9d audio in ubuntu terminal
In ubuntu terminal, is there any command to make all mp3 in a folder to 8d or 9d audio. Something like ffmpeg or other?
According to mashable,
8D audio is essentially an effect applied to a stereo ...
0
votes
0
answers
99
views
Unable to get input via Gedit embeded terminal
I have written the below bash script to compile and run my C programs, and added it to the 'Manage External Tools' list.
#! /bin/bash
cd /home/prm/Documents/Anubhav/C
FILE="$(ls -Art | tail -n 1)&...
0
votes
1
answer
482
views
SMB mount - no write access by terminal but by gui
I want to mount a SMB share by the following command of a bash script, which works perfectly:
read -p "username : " user_var
read -sp "password : " pass_var
echo
...
3
votes
1
answer
1k
views
Copy (or move) some files with their parent dirs
I have 2-3 levels and several folders but in all is a file with the name L_data.txt (among other files). I would like to copy only those L_data.txt together with their parent folders without any of ...
-1
votes
1
answer
1k
views
How to de-source the source items in .bashrc without comment?
How to de-source the source items in .bashrc without comment?
I want to make the source item do not work in the .bashrc file. The specific item is 'source ~/miniconda3/bin/activate' in .bashrc. I do ...
0
votes
1
answer
100
views
The meaning of the code [closed]
What is the code below means?
if ["$SHLVL" =1]: then
[-x /usr/bin/clear_console] && /usr/bin/clear_console -q
fi
Actually I'm trying to solve the problem in the picture:
3
votes
3
answers
5k
views
How do I resize multiple videos using ffmpeg?
I tried to resize multiple Video in different way on my slow server instance with Ubuntu 18.
When generate a batch script file with:
ffmpeg -i video1.MP4 -vf scale=854:480 smallvideo1.MP4 &
ffmpeg ...
1
vote
1
answer
66
views
supress generatenewblock output
I am issuing a command as follows:
rando-cli generate 1 > /dev/null 2>&1
yet still I see output such as
2020-06-19T17:54:29Z [default wallet] keypool reserve 17
2020-06-19T17:54:29Z ...
1
vote
1
answer
45
views
Desktop directory
I'm trying to run a Python script using the Desktop directory but it's not working. It instead outputs "bash: ./s.py: Permission denied"
In the said script on top I put "#!/usr/bin/...
0
votes
0
answers
31
views
Unable to Login after updating a Path Variable
I wanted to add a path to my flutter SDK in my Ubuntu. So I added export PATH= "$PATH: $HOME/Documents/Dev/App_Dev/flutter/bin" in the .bashrc file. After that whenever I started the ...
1
vote
1
answer
2k
views
Git_prompt branch no longer working after upgrade
I made a ps1 prompt a few years ago. Took a while to config it, now after upgrading it no longer works.
The .bashprompt script (which gets loaded into my .bashrc along with git-sh-prompt) it will ...
5
votes
1
answer
1k
views
How to move found files to another directory?
Hello to everyone I have the following script that works fine except the mv argument. The script basically searching for the files that were created at a specific time and the I need to move all of ...
0
votes
1
answer
2k
views
Append specific output from ubuntu terminal in a csv file
Above is the output of my command. I want to save the highlighted output into a csv file in append mode. They should be in the same row but in different columns. My final csv file should be like this
...
0
votes
0
answers
2k
views
How to set environment variables for executable file
I recently installed vcgencmd on my Raspberry Pi with Ubuntu ARM64;
but I can't use vcgencmd command in .sh file without writing PATH=$PATH in it.
I can use it normally on terminal.
I tried adding
...
2
votes
2
answers
2k
views
certbot doesn't run from crontab
I installed certbot from pip3:
# pip3 freeze|grep -i certbot
certbot==1.5.0
certbot-apache==1.5.0
certbot-dns-digitalocean==1.5.0
I can run certbot from the command line as root, but I configured ...
1
vote
1
answer
2k
views
Executing a script with chroot; permission denied
I want a script to execute a few commands in chroot. So, like this answer proposed scripting chroot, how to? I added the following part in my script, creating a .sh file with the commands I want it to ...
0
votes
1
answer
212
views
echo 1 > “runcount.txt” not writing to the file
I am trying to maintain a count of how many times my script evaluates a specific condition to true and want to have its count written to a separate file.
Below are the relevant contents of my file.
#!/...
1
vote
1
answer
2k
views
Can't Activate Environment // Ubuntu // Conda
I downloaded Anaconda 3 on Ubuntu VM. The conda command wasn't working so I used this command:
source ~/.bashrc
but it didn't work. Then I tried this command:
export PATH=~/anaconda3/bin:$PATH
This ...
25
votes
2
answers
9k
views
User root can't write to file in /tmp owned by someone else in 20.04, but can in 18.04
In Ubuntu 18.04, I can create a file as one user in /tmp, and write to it as user root (despite the sticky bit being set on /tmp).
In Ubuntu 20.04, I get a Permission Denied error as user root.
Ubuntu ...
1
vote
0
answers
201
views
How can I see what happens in the terminal without using xterm?
So I want to run a simple script in a terminal windows such that the terminal window opens, my command(s) are being executed, and then it closes with an echo line. Like
#!/bin/bash
rm -r /home/test
...
1
vote
1
answer
129
views
Problem with executing alias of a command on Ubuntu 18.04
I created an alias file for holding alias
nano .bash_aliases
and then used the command
alias ganache='./ganachescript'
However,
$ ./ganachescript
08:29:17.571 › Checking for update
08:29:19.052 › ...
1
vote
0
answers
636
views
Run bash script with prompts on startup, then start browser
I am creating a standard linux image for my customers, which I want to distribute to them as a backup.
I have written a bash script - verifysetup.sh which checks whether the machine has already been ...
0
votes
2
answers
429
views
Install latest version of dotnet-sdk by script
I am writing an installer script and need to install dotnet-sdk.
I want to install the latest version which is 3.1 or in future 3.2 or whatever.
Now I found that there are 2 versions in apt-get:
user@...
0
votes
1
answer
224
views
print parameters from a for loop in bash
So, i want to print the parameters of the script that meet some conditions :
t1=0
for i in $@; do
if [ $i == "-1" ] || [ $i == "-2" ] || [ $i == "-3" ]; then
t2=$(($t1+...
2
votes
0
answers
3k
views
xdotool simulate ctrl key holding
i need to simulate ctrl key holding for multi selecting action by ctrl and mouse click, so i tried this short key :
bash -c "notify-send 'ctrl pressed' 'message';xdotool keydown Control_L ; ...
0
votes
1
answer
48
views
zero length variable added to for iteration not working
The question is simple . I have the following script in bash :
#!/bin/bash
a=`echo " 1 2 3 hello " | egrep -o "1"`
b=`echo " 1 2 3 hello " | egrep -o "2"`
c=`...
0
votes
0
answers
449
views
Cron error - Text file busy
According this article I wrote cron job for database backups and if I run it manually on command line it works fine. But if script runs as cron job it fails on error: Text file busy Can somebody tell ...
1
vote
1
answer
263
views
Vim: How to enter a normal editor command in shell before literally oppening
There is a command option when you run vim to open a file with command-line that i found when i was searching. here it is:
vim "+ normal G" textfile
When you use the command + normal G vim ...
0
votes
2
answers
1k
views
Bash script for periodically launching and killing an app
I have a short script which should launch an app, wait for an hour, then kill it and wait for a minute. It only starts the app. I tried to run the script both as a normal user and root, but nothing ...
0
votes
1
answer
3k
views
Start terminal with command from crontab
I am trying to run a python script in a new terminal using crontab:
Crontab:
* * * * * /usr/bin/sh /root/teststart.sh
teststart.sh:
#!/bin/sh
xfce4-terminal -e "/usr/bin/python3 /root/teststart....
0
votes
0
answers
626
views
No such file or directory - bin error
I am trying to run a application through my tcl script.
Typically I would go to the directory cd /OpenTimer/ and then type ./bin/ot-shell to run the application.
In my script the line that executes ...
3
votes
4
answers
4k
views
Combine two commands into a single command
I'm looking for a way to combine these two so I can do it in one step from the command line. (I think %1 would be in the command.)
convert Tess.jpg tess.tif
tesseract tess.tif tess
For example:
...
7
votes
2
answers
3k
views
Why does this awk script that runs on CentOS not run on Ubuntu?
(for reference, the code is likely also here:
https://github.com/garyexplains/examples
which is probably a better source than a video.)
Would there be any reason why this simple script on CentOS ...
2
votes
2
answers
3k
views
Every time I open the terminal, several commands are already executed
I am a beginner and have not used Linux for a long time. Now I no longer know what I did then that every time I open the terminal 3 commands are executed, which I no longer need and which no longer ...
1
vote
1
answer
2k
views
Errors executing bash script: Permission denied; No such file or directory
I'm just getting started with Ubuntu. I am trying to create a script that will do the following:
Perform an ls -al on the files within a user's home directory and then save it to a file in my ...
1
vote
0
answers
133
views
How can I copy several directories with expect?
I have the following script which I adapted from https://stackoverflow.com/questions/1346509/automate-scp-file-transfer-using-a-shell-script. The script works very well for copying one directory. I ...
0
votes
1
answer
1k
views
How to create a bash script to create images from pdf file and then crop all of the *.png images to 1920x1080 (using mogrify)?
I want to create a bash script that can be executed from everywhere, that does this following:
It creates images from a pdf file using pdftoppm:
pdftoppm fileinput.pdf -png img -r 305.3
After all of ...
0
votes
1
answer
354
views
Bash script if condition does not work
I've got a bash script with some user inputs. So in order to run smoothly it is nessecary to run in a terminal emulator (so the user can make the inputs).
Because of that i've wrote in the first lines ...
2
votes
0
answers
389
views
how to source bashrc from the eclipse terminal?
How do I configure eclipse so that I have access to bash complete with my aliases? I ran:
[org.eclipse.Java ~]$ alias
[org.eclipse.Java ~]$ source /home/thufir/.bashrc
but that seems awkward. Also:...
0
votes
2
answers
392
views
How to create a bash script using a bash script?
I am trying to create a post-installer script which itself creates a bash script (startapp script).
This is the original startup script:
#!/bin/bash
if [ `wmctrl -l | grep -c "$2"` != 0 ]
then ...
0
votes
0
answers
177
views
Modified .Bashrc file unable to boot ubuntu
I just update my .bashrc file in ubuntu to insert enviroment,
after i reboot my pc i manage to show GRUB dual boot menu and when i choose ubuntu i gave me black screen,
like this
blank screen
can ...
3
votes
2
answers
2k
views
Rename multiple files with variable extensions to remove beginning and end of filename
I have multiple files I need to rename as below:
5891_1_0_AD3884_ACTCTCGA_S10.bam
5891_1_0_AD3884_ACTCTCGA_S10.bam.bai
5891_1_AD3875_GAGCTTGT_S1.bam
5891_1_AD3875_GAGCTTGT_S1.bam.bai
...
0
votes
1
answer
4k
views
Eclipses: no consoles to display at this time
How do I get a bash terminal or console from within Eclipse itself?
but no prompt:
I just see:
no consoles to display at this time
"Window->Show View->Other". Search for Terminal and select "Open"....
0
votes
2
answers
1k
views
When using a shell script, minecraft/java throws errors
Basics:
This is a learning experience, I am new and doing this to expand my knowledge. So if you can please explain in detail...it would be appreciated.
This is a new install of Ubuntu Server, it is ...
2
votes
1
answer
1k
views
Automatically Resize Partitions to Bare Minimum Needed to Store Files
I am currently writing a bash script in Ubuntu 20.04 LTS that automatically backs up devices that are running ubuntu-server 18.04 LTS. I don't think this is version-specific, so I didn't tag it that ...
1
vote
1
answer
398
views
How to list partition in a dialog menu?
Is there any way to allow the user to select a partition from dialog’s menu (--menu) selection feature? If so, how do you do it?
Of course, this does not work:
dialog --menu "Select a partition" 0 0 ...
0
votes
1
answer
280
views
How does redirecting a command output to a file deals with opening and closing that file?
If we redirect a command such as sar -r 1> a_file.txt how does this works with opening, writing the output of the command and closing the file?
In other words, how does redirecting a command ...
2
votes
1
answer
2k
views
How to give input to a script running using nohup?
I have a script running on my server, say test.sh. I executed it using the following command -
nohup test.sh
Now I want to pass an input quit to this script so that it'll terminate itself ...
1
vote
0
answers
496
views
Oh My Bash problem
After I installed oh my bash, I used some themes like agnoster for my bash and i started to code, but when I used command cd and pressed tab it said there's about 360 possiblities and there was at ...
2
votes
1
answer
457
views
Restricted shell is not working for a newly created user (ubuntu 18.04)
I want to create a new user with a restricted shell so I :
ln -s bash rbash # create a symbolic link to bash with a name "rbash"
useradd -s /bin/rbash student # add a new user with a shell ...