DEV Community

Ali Osman
Ali Osman

Posted on

how to make this bash script

Top comments (1)

Collapse
 
hawarih profile image
Ali Osman

I have txt file with empolyees names, I wanrt search for all lines that contain the name "Raj" and save the file names into a variable. Let's call this variable names,

Since none of the files present in the file list.txt are available in the file system, how to check if file names present in files variable are actually present in the file system. how to do this, test command

then how to 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 name.txt.

can any one help on this sccript please