Using bash script write a function named join_with that will join the positional parameters with a character. The function would work like this:
join_with "," 1 2 3 4 5
1,2,3,4,5
join_with "-" 12 34 56 78
12-34-56-78
join_with ":" {a..z}
a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z
Code:

Output:

Raw Code:
#!/bin/bash
join_with () {
all=$(IFS=$1 eval 'echo "$*"'); # joining the all
arguments with given delimiter
echo "${all[@]:2}" # Eliminating the delimiter at the
first place
}
# Calling function with different cases:
join_with "," 1 2 3 4 5
join_with "-" 12 34 56 78
join_with ":" {a..z}
If you have any doubts plz ask in comment section.
Using bash script write a function named join_with that will join the positional parameters with a...
Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...
Please write a bash script for the following two questions, thank you. Write a shell script “6-1.sh” to calculate the exponentiation using while loop. This script needs to take two inputs like “6-1.sh a b”, and outputs the result of “ab”. Note: You need to implement it, DO NOT use the exponentiation operation provided by the Linux. Write a shell script “6-2.sh” to calculate the factorial of a number using while loop. This script needs to take one input...
Write a bash shell Script to look like this using C-style nest for loop. | 1 2 3 4 5 6 7 8 9 10 11 12 -----+------------------------------------------------------------ 1 | 1 2 3 4 5 6 7 8 9 10 11 12 2 | 2 4 6 8 10 12 14 16 18 20 22 24 3 | 3 6 9 12 15 18 21 24 27 30 33 36 4 | 4 8 12 16 20 24 28 32 ...
I need help with this. 1. In a bash shell script, what are the required elements of an "if" control structure? 2. In a bash shell script, what are the optional elements of an "if" control structure? 3. In a bash shell script, what are the required elements of a "while" control structure? 4. What is the difference between a shell variable and environment variable? Which one is considered local and which is considered global? 5. List the four kinds...
In Putty
1. Create Bash shell script that would let a user make a copy of all the files in a directory. (3 points) 2. Create two Bash shell scripts that will perform some work (of your choice). (2*3 = 6 points) 3. Create a Bash shell script that would serve as a menu for the three scripts you have created. (1 point)
Exercise 13.5 Write a Bash script that contains two numeric arrays, array1 and array2, initialized to the values in the sets {1, 2, 3, 4, 5} and {1, 4, 9, 16, 25}, respectively. The script should produce and display an array whose elements are the sum of the corresponding elements in the two arrays. Thus, the first element of the resultant array is 1 + 1 = 2, the second is 2 + 4 = 6, and so on.
/* Write a recursive function named editDistance that accepts two string * parameters and returns the "edit distance" between the two strings as an * integer. Edit distance (also called Levenshtein distance) is the minimum * number of "changes" required to get from s1 to s2 or vice versa. A "change" * is a) inserting a character, * b) deleting a character, or * c) changing a character to a different character. *...
1. Write a function named findTarget that takes three parameters: numbers, an array of integers - size, an integer representing the size of array target, a number The function returns true if the target is inside array and false otherwise 2. Write a function minValue that takes two parameters: myArray, an array of doubles size, an integer representing the size of array The function returns the smallest value in the array 3. Write a function fillAndFind that takes two parameters:...
using bash do the following script 1. Enter a list 2. Find the sum of the list 3. Find the average of the list 4. Find the max of the list