Linked Questions

1 vote
2 answers
3k views

Is it the same convention as those used in known programming languages such as Java and C? I'm trying to create a lot of variables and I want it to start with a number, but I'm not sure if it's okay.
Miguel Roque's user avatar
89 votes
14 answers
52k views

At work, I write bash scripts frequently. My supervisor has suggested that the entire script be broken into functions, similar to the following example: #!/bin/bash # Configure variables ...
Doktor J's user avatar
  • 2,682
15 votes
2 answers
4k views

I am new to bash scripting and started out with a few sample scripts. One is: #!/bin/bash SECONDS=5 i=1 while true do echo "`date`: Loop $i" i=$(( $i+1 )) sleep $SECONDS ...
MaxG's user avatar
  • 403
7 votes
6 answers
13k views

I'm currently writing a small script to backup bulks of floppy disks and format them afterward for later use. I use dd to copy the disk's image and cp to copy all the files on the disk. Here are the ...
Informancien's user avatar
4 votes
2 answers
2k views

Variables and procedures in JavaScript are often named via the "camelCase" naming method, as: myVariable Any letter of the only or not-only-but first letter in an expression which acts as ...
timesharer's user avatar
9 votes
1 answer
4k views

I always thought that PS1 was an environment variable. But when I check the default .bashrc of Ubuntu and check for PS1 with grep PS1 /etc/skel/.bashrc there is no export PS1. If there is no export, ...
bob dylan's user avatar
  • 2,012
-1 votes
3 answers
29k views

How to download all files of a GitHub project with wget? All files should be downloaded in their raw form. Already tried: wget -P ~/ https://raw.githubusercontent.com/u/p/b/* wget -P ~/ https://raw....
user273993's user avatar
1 vote
2 answers
26k views

I want to write shell script to output two variables in one line. My script is: SRC = "192.168.1.1" PORT = "22" I want to make the output looks like 192.168.1.1,22 How to do this? Thank you.
Jess Brown's user avatar
2 votes
3 answers
7k views

I would like to process a multiline string and iterate it line by line, in a POSIX shell (/bin/sh) on a BSD platform. Bash is not included in the base BSD-distribution and has a GPL license - so I am ...
Steiner's user avatar
  • 310
5 votes
3 answers
4k views

My bash script: #!bin/bash MY_ARRAY=("Some string" "Another string") function join { local IFS="$1"; shift; echo -e "$*"; } join "," ${MY_ARRAY[@]} I want the output to be: Some string,Another string....
Username's user avatar
  • 899
5 votes
2 answers
11k views

I spent quite a bit of time messing around with tmux recently, and cannnot figure out what I am doing wrong. It seems to me that some layouts are simply not allowed. There is no error or warning ...
Livid's user avatar
  • 153
1 vote
2 answers
9k views

I have separate scripts for tasks in bash. Here is the broken one: #!/bin/bash PATH=/home/name/ mkdir $PATH cd $PATH && echo "done." exit 0 Today it broke and first time it simply didn't want ...
NapoleonTheCake's user avatar
4 votes
1 answer
2k views

My script: #! /bin/bash -- set -x ## docker-compose wrapper compose_fn() { local ENV="${1}" local VERB="${2}" local SERVICE="${3}" local CMD="docker-compose -f ${ENV}.yml" case "${VERB}" ...
NarūnasK's user avatar
  • 2,535
4 votes
1 answer
2k views

I have a bash script that accepts a parameter "$input" and (among other things) directs it into a program and collects the output. Currently my line is: OUTPUT=`./main.exe < $input` But I get ...
Erel Segal-Halevi's user avatar
0 votes
3 answers
2k views

Which of the following quoting styles, for GNU Bash variables, is preferred and why? Two double quotes: VAR="/path/$V1/path with space/$V2". Multiple double quotes: VAR=/path/"$V1"/"path with space"/"$...
Klorax's user avatar
  • 244

15 30 50 per page