Category "bash"

How do you compare the value of an array to a variable in bash script?

I'm practicing bash and honestly, it is pretty fun. However, I'm trying to write a program that compares an array's value to a variable and if they are the same

How do you compare the value of an array to a variable in bash script?

I'm practicing bash and honestly, it is pretty fun. However, I'm trying to write a program that compares an array's value to a variable and if they are the same

How to check if ssh-agent is already running in bash?

I have a sample sh script on my Linux environment, which basically run's the ssh-agent for the current shell, adds a key to it and runs two git commands: #!/bi

history -a vs -w in BASH. How to replace/append and ignore/erase duplicates?

I'm writing my PROMPT_COMMAND="history -a;$PROMPT_COMMAND" but I still get some duplicates from different terminal sessions. It seems I still will get some dupl

How to split strings over multiple lines in Bash?

How can i split my long string constant over multiple lines? I realize that you can do this: echo "continuation \ lines" >continuation lines However, if you

How to check the checksum through commandline?

I want to do something like this on commandline on my UNIX variant if (shasum httpd-2.4.7.tar.bz2 == 19asdasdasd56462e44d61a093ea57e964cf0af05c0e) echo 'good t

gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now

I have a Bash script that creates a .tar.gz file, encrypts, and then sends it to a drive. However, I cannot open the .tar.gz file afterwards. Here is my process

Rename multiple files, but only rename part of the filename in Bash

I know how I can rename files and such, but I'm having trouble with this. I only need to rename test-this in a for loop. test-this.ext test-this.volume001+02.

Mac Terminal Sending Email With Attachment

I'm trying to make a bash script that will send an email to all contacts which will contain a message and an attachment. This is not for malicious purposes. Ho

Difference between sh and Bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know what's the difference between them. What's main difference

Running shell script in parallel

I have a shell script which shuffles a large text file (6 million rows and 6 columns) sorts the file based the first column outputs 1000 files So the pseu

How to grab text after newline in a text file no clean of spaces, tabs [closed]

Assume this: It needs to pass a file name as an argument. This is the only text I’m showing. The remaining text has more data (not shown

Script to clear dummy files like .DS_Store ._foo thumbs.db etc

I have a external drive that I use on my car and on my TV, I use Mac OS X to manage files, but the hidden files that the Finder and Windows creates is very anno

Script to clear dummy files like .DS_Store ._foo thumbs.db etc

I have a external drive that I use on my car and on my TV, I use Mac OS X to manage files, but the hidden files that the Finder and Windows creates is very anno

Bash command line and input limit

Is there some sort of character limit imposed in bash (or other shells) for how long an input can be? If so, what is that character limit? I.e. Is it possible

Problem with passing parameters in a shell function

I have the following shell script. There is a deploy function, that is used later in the script to deploy containers. function deploy { if [[ $4 -eq QA ]]

How can I show the wget progress bar only? [closed]

For example: wget http://somesite.com/TheFile.jpeg downloading: TheFile.tar.gz ... --09:30:42-- http://somesite.com/TheFile.jpeg

bash script to check if the current git branch = "x"

I am very bad at shell scripting (with bash), I am looking for a way to check if the current git branch is "x", and abort the script if it is not "x". #!/

How I can directly login to rails console through ssh?

Time to time I repeat the following commands: ssh username@servername cd /projects/rails_project bundle exec rails c production I want to create a shell scri

grep after grep : No such file or directory

To create a test file contains blanks in the filename first: vim "/tmp/it is a test.txt" bash escape Search with grep: grep -lr 'bash' /tmp /tmp/it is