? check two conditions in if statement in bash

I have problem in writing if statementvar1=`COMMAND | grep <Something>`if [ -n "$var1" ] && if [[ "$var1" != string ]]; then . . .fiI want to write if statement that check:If va
 ? String contains in Bash that is a directory path

I am writing an SVN script that will export only changed files. In doing so I only want to export the files if they don't contain a specific file.So, to start out I am modifying the script found here.
 ? Replace string with text only when a given text precedes it

I have about one hundred Markdown files that contain snippets of Latex like this:<div latex="true" class="task" id="Task">(@) Delete the fourth patterns from your .teach file and your .data file
 ? Making wget a bash.sh

Need help turning this wget string in to a bash script because I use it frequently. wget -nd -H -r -l 1 -A jpg,jpeg,bmp,gif,png,mp4,webm -e robots=offSo far I have tried #!/bin/bashwget -nd -H -r -l 1
 ? bash - storing absolute path to a file inside a variable

I'm trying to figure out why [ -d ~/dir ] ; echo $?indeed returns 0, if dir exists and is a directory, but DIR="~/dir" ; [ -d "${DIR}" ] ; echo $?always returns 1. echo "${DIR}"prints ~/dir, as ex
 ? Bash: retrieve absolute path given relative

Is there a command to retrieve the absolute path given the relative path?For example I want $line to contain the absolute path of each file in dir ./etc/find ./ -type f | while read line; do echo $l
 ? Can I set the vim colorscheme from the command line?

I have a hotkey set to automatically create some aliases and install a script whenever I SSH into a server (for my work). Does anyone know of a way to set the vim colo from the command line so I can u
 ? How to I get the primary IP address of the local machine on Linux and OS X?

I am looking for a command line solution that would return me the primary (first) IP address of the localhost, other than 127.0.0.1The solution should work at least for Linux (Debian and RedHat) and O
 ? Bash. Generate random mac address (unicast)

I need to generate in bash random mac addresses without using macchanger or similar.I have this:random_mac=$(hexdump -n6 -e '/1 ":%02X"' /dev/random | sed s/^://g)But with this sometimes, if you try t
 ? How to execute a bash command stored as a string with quotes and asterisk

This question already has an answer here: In bash, why do shell commands ignore quotes in arguments when the arguments are passed to them as a variable?
 ? Rsync and quotes

This question already has an answer here: Setting an argument with bash 2 answers You shouldn't put $ in front
 ? postgres will not allow less to chop long lines

Every time I get a big query, I try to type -S in my pager (less), and while I see the prompts for "chop long lines" and "fold long lines", nothing happens when I hit enter.Also: this option should be
 ? bash countdown(up?) timer w/alarm: improvements?

MIN=1 && for i in $(seq $(($MIN*5)) -1 1); do echo -n "$i, "; sleep 60; done; while :; do beep -r 25 -l 3; sleep 5; doneI decided recently to experiment with the pomodoro work/learning techniq
 ? send key code to command line program os x bash script

I want to make a script that starts a program and then sends it key input. In psuedo-script:#!/bin/bash./program << (PRESS CONTROL-Z)The program is running so if there were additional commands i
 ? How to accommodate spaces in a variable in a bash and iterate in directory tree in linux

I am writing a bash script to iterate in directory and sub-directories, check if a file opened by a process,if yes move it to another locationif no skip itMy issue is that the Source folders have Spac
 ? Displaying the result of find / replace over multiple documents on bash

I love to use the following command to do find / replace across multiple files in bash:find -wholename "*.txt" -print | xargs sed -i 's/foo/bar/g'However, the above command process everything in silen

Page 2 of 526  |  Show More Pages:  Top Prev Next Last