subject

Question : Find files using bash script. Navigate to /scripts directory and create a new file named findJane. sh. Create the text file oldFiles. txt and make sure it's empty. This oldFiles. txt file should save files with username "jane". Now, search for all lines that contain the name "jane" and save the file names into a variable. Let's call this variable files, we will refer to it with that name later in the lab. Since none of the files present in the file list. txt are available in the file system, check if file names present in files variable are actually present in the file system. To do this, we'll use the test command that we practiced in the previous section. Now, iterate over the files variable and add a test expression within the loop. If the item within the files variable passes the test, add/append it to the file oldFiles. txt. My entry in nano is as follows : #!/bin/bash > oldFiles. txt files-$(grep " jane " ../data/list. txt | cut -d ' ' -f3) for i in $files:do if test -e $HOME$i, then echo $HOME$i>>oldFiles. txt; fi done Error message after entering chmod +x findJane. sh and ./findJane. sh: ./findJane. sh: line 3: files-/data/jane_profile_07272018.d oc: No such file or directory ./findJane. sh: line 5: syntax error near unexpected token `if' ./findJane. sh: line 5: `if test -e $HOME$i, then echo $HOME$i>>oldFiles. txt; fi' Appreciate your help thank you!

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
You know the right answer?
Question : Find files using bash script. Navigate to /scripts directory and create a new file named...
Questions
question
Mathematics, 24.04.2021 14:00
question
Arts, 24.04.2021 14:00
question
Advanced Placement (AP), 24.04.2021 14:00
question
Computers and Technology, 24.04.2021 14:00
question
Mathematics, 24.04.2021 14:00
Questions on the website: 13722367