1. Write a bash script that will accept a list of files on the command line and append each file to a new file. The name of the new file should be created from the first characters of the input files....

1 answer below »

1. Write a bash script that will accept a list of files on the command line and append each file to a new file. The name of the new file should be created from the first characters of the input files. For example, if the input files are a.txt, b.txt, and c.txt then the new file should be abc.txt

2. Write a bash script that will accept the full path of a directory on the command line, and then remove that directory from the PATH variable. Be sure to check your PATH variable after the command has executed to make sure the change was completed.

3. Write a bash script that will accept the full path of a directory on the command line, and then add that directory AND all of its subdirectories to the PATH variable. Be sure to check your PATH variable after the command has executed to make sure the change was completed.

4. Write a bash script that will display a count of the number of directories in your PATH variable.

5. Write a bash script that will display a count of the number of your environment variables that begin with an upper case character (A through Z).



1. Write a bash script that will accept a list of files on the command line and append each file to a new file. The name of the new file should be created from the first characters of the input files. For example, if the input files are a.txt, b.txt, and c.txt then the new file should be abc.txt 2. Write a bash script that will accept the full path of a directory on the command line, and then remove that directory from the PATH variable. Be sure to check your PATH variable after the command has executed to make sure the change was completed. 3. Write a bash script that will accept the full path of a directory on the command line, and then add that directory AND all of its subdirectories to the PATH variable. Be sure to check your PATH variable after the command has executed to make sure the change was completed. 4. Write a bash script that will display a count of the number of directories in your PATH variable. 5. Write a bash script that will display a count of the number of your environment variables that begin with an upper case character (A through Z).
Answered Same DayJun 06, 2021

Answer To: 1. Write a bash script that will accept a list of files on the command line and append each file to...

Ria answered on Jun 07 2021
153 Votes
script1.sh
#!/bin/bash
# Write a bash script that will accept a list of files on the command line
# an
d append each file to a new file. The name of the new file should be
# created from the first characters of the input files. For example, if
# the input files are a.txt, b.txt, and c.txt then the new file should be
# abc.txt
# initialize with no name
file=''
# repeat a loop for each text file
for f in "$@"
do
    # concatenate each file name
    file+=`echo $f | cut -f1 -d'.'`
done
# name the extension
file+=".txt"
# remove file if exists
rm -f $file
# repeat a loop for each text file
for f in "$@"
do
    # append the contents from each file
    cat $f >> $file
done
script2.sh
#!/bin/bash
# Write a bash script that will accept the full path of a directory on the
# command line, and then remove that directory from the PATH variable.
# Be sure to check your PATH variable after the command has executed to
# make sure the change was completed.
# check the full path of directory exist or not
if [ -e $1 ]
then
    # whether...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here