Make a Function that returns a comma separated list in the order of
"DirectoryName, Filename, FileExtension"
#!/bin/bash
filename=$1
echo "$(dirname $filename), $(basename ${filename%.*}), ${filename##*.}"
output = run_shell args: ["/Users/Tech/Desktop/backup/Nutters_with_Putters_Revenge_of_the_Nutters2.avi"]
describe "Solution" do
it "Should return Comma Separated List" do
expect(output).to include("/Users/Tech/Desktop/backup, Nutters_with_Putters_Revenge_of_the_Nutters2, avi")
end
end
Try to return the File Extension from the provided arguement.
#!/bin/bash
file1=$1; echo ${file1##*.}
output = run_shell args: ['/Users/Desktop/backup_folder/Grandma_got_run_over_by_a_reindeer.mpg']
describe "Solution" do
it "Should return file extension" do
expect(output).to include("mpg\r\n")
end
end