'Passing the path of a file as an argument in bash
I have a bash script like this where I pass in a file path into it
groups=$1
file=$2
if $groups
then
sh with_groups.sh $file
else
sh without_groups.sh $file
fi
What I currently do: Open the folder where my file is, do pwd, copy the link, add some_csv.csv to it and run the above script. I want to find a more efficient way to do it.
The equivalent of what I would would be something like
sh ./../run_script.sh true pwd/some_csv.csv
where pwd is the current path I am in (true refers to the first argument. You can disregard that for the purpose of this question)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
