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”,...
5. Write a bash command that will display the name of every file on the Linux...
5. Write a bash command that will display the name of every file on the Linux system whose file contaent contains the string "doug.jones". The command must run in the background, must redirect standard error to /dev/null, and must redirect standard output to ~/out. 6. Write a bash command that will kill all of the even-numbered processes associated with your userid, and no other processes. 7. Write a bash command that will start the program /home/courses/140u-doug.jones/zombie_maker as a background process,...
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 File Systems: Please write down a pseudo code that implements shell command “find . -name...
Linux File Systems: Please write down a pseudo code that implements shell command “find . -name myfile -print”.
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...