Question

Linux Write a script that takes a name as a parameter, then checks if the name...

Linux

Write a script that takes a name as a parameter, then checks if the name is a file that exists in your homedirectory. Make sure to display the result.

Homework Answers

Answer #1

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE

#!/bin/bash
if [ -e "/home/nikhil/$1" ];
then
echo "The file Exists"
else
echo "The file is not present"
fi

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is for my linux class. Write a script called activity4.2-3 that modifies your activity4.2-2 script...
This is for my linux class. Write a script called activity4.2-3 that modifies your activity4.2-2 script to also display a message when the user provided is not logged on. An example is shown below. Purpose: Determine if someone is logged on bash-3.2$ ./activity4.2-3 nonuser nonuser is either not logged on or not a valid user Include a first line that calls the bash shell as the interpreter Add a comment to state the purpose of the script and other comments...
Write a linux bash script that enables user to create his resume make sure that the...
Write a linux bash script that enables user to create his resume make sure that the assigned value doesn't change.
PLEASE WRITE A BASH SCRIPT FOR USE IN JUYPTER NOTEBOOK. Initialize a variable INPUT_FILE that stores...
PLEASE WRITE A BASH SCRIPT FOR USE IN JUYPTER NOTEBOOK. Initialize a variable INPUT_FILE that stores the name of the file 'testdata.csv'. Write an if-else statement in a shell that checks if the input file exists. If the file exists, then display a message "testdata.csv exists," otherwise display a message "testdata.csv does not exist." Initialize an array variable named 'ARR_WORDS' as below: ARR_WORDS=("naresh" "sam" " david" ) Initialize an array variable named 'ARR_COUNTS' of size equal to the length of...
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
How would I go about answering these questions In linux. Please provide the correct linux command...
How would I go about answering these questions In linux. Please provide the correct linux command needed to answer these 4 questions 5. Display total words of each file under your root directory and subdirectories. 6. Change permission of every filename ends “.py” to — write read execute, group - read execute, other - execute 7. Find every line which contains “hello” from your file system, display both file name, line number. 8. Combine files with name “p3.py”, “p31.py”, “p32.py”,...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items separated by a space. Read the list. Use a for loop to write (use echo) the items to a file called shopping_list. You should use >> to append the output to the file, so each time the script is run the list should get longer. After the for loop finishes, display (use cat) the contents of the shopping list with 1 item per line....
Linux: Regular Expressions file name is studentsyslog.txt Use a regular expression and grep or egrep to...
Linux: Regular Expressions file name is studentsyslog.txt Use a regular expression and grep or egrep to filter the file so the output displays only the items requested. Put your full command in the space provided. Display only the lines which contain the word CUPS
In UNIX .Write a bash script that takes a list of usernames as its command line...
In UNIX .Write a bash script that takes a list of usernames as its command line arguments and displays on the screen, for each user name, a message of the form Number of times that logged into this machine is where is to be replaced by the number of recors that the last command output that match exactly. For example, if i enter command logincount mark it should output something like number of times that sweiss logged into this machin...
Write a shell program named HELOO (this should be done linux) Your program should set permissions...
Write a shell program named HELOO (this should be done linux) Your program should set permissions for a file named A1testFile so that the current premissions remain, except execute permissions are REMOVED for everyone, including owner. Your must accomplish this with a single chmod command. A1testFile should be specified as a relative path name to a file in the current directory (the directory the user is in when they run your program). Your program should not display any error messages,...
Write a program containing a function, reverseDigit, that takes an integer as a parameter and returns...
Write a program containing a function, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed, then printout the return result. For example, the value of reverseDigit(12345) is 54321; the value of reverseDigit(5600) is 65; the value of reverseDigit(7008) is 8007; and the value of reverseDigit(-532) is -235.    Modify the following program to make a correct output. /* // Name: Your Name // ID: Your ID // Purpose Statement: ~~~ */ #include <iostream>...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT