So my folder structure looks like this:
User/name/test/files
Each of those is a different folder. We are currently working in test
, where we have the bash script, testscript
. In the files
folder, we have a text file, aptly named, testfile
. testfile.txt
contains a line of text.
testscript
looks like this:
#!/bin/bash
cat < User/name/test/files/testfile.txt
This displays the file. But what if I wanted to distribute this on Git? It wouldn't run successfully on other computers.
I guess my question is, how can I tell a script what it's current directory is so I may access other files in deeper folders? Would it be a smarter idea to place the file in the folder with the test script?