How to ask for a path from the user in XML and shell?

I am working on a small plugin for Galaxy, which is written in shell script.The XML wrapper shows multiple options of paths where the user would like to store the file. I now want to add an option where the user can specify the path. Also,he can specify the name of the output file.As I am new to XML and Shell, I would be grateful for any suggestions. Many thanks in advance.

Well, if they pick that option from the list, it needs to be detected before processing the answer, and an additional field or read needs to get the choice. Do you want to accept only directories already there? You can make them with mkdir -p all at once, but that might introduce too much chaos. You might want to check writability of the directory and any file overwritten. Do you allow file overwrite now?

As of now, they can select specified directories. I want them to select an option saying something like "Different path" and then they se a text box where they write the path.

But what if the directories in that path do not exist? Normally, that raises an error.

Ya, thats right. So, it should validate the path or make the directory .
So, how do I go about it?

Which shell? bash has a read that can prompt the user and load a shell variable with the answer. If it is a directory, you can test it with 'if [ -d "$varname" ]' and 'if [ -w "$varname" ]' to ensure existence and writability, respectively.

1 Like

I shall try it out tomorrow:)