Passing arguments to Colab .ipynb script - arguments

I just mounted my project to Colab ./content directory but I don't know how to pass arguments to my script. Can you tell me how to do it ?

Related

Create alias of an executable binary as absolute path

Considering an executable binary file mybinaryfile, I want to write a bash script that creates an alias mybinary which then allows me, after executing the script, to run the binary file regardless of its location and of the location I am when calling the binary file. Do you know how I can achieve this without writing the path to the binary to the PATH environnement variable ?
Thanks
Well, someone told me to use this (script must be in the same folder as the binary when executing it) and it works pretty fine :
current_path=$(pwd)
alias mybinary="$current_path/mybinaryfile"
Then I can finely call
mybinary -flag1 arg2
wherever I want on my terminal session

Unable to Pass option using getopts to oozie shell Action

I created a script in shell and passing the arguments using getopts methods in my script like this:
sh my_code.sh -F"file_name"
where my_code.sh is my unix script name and file_name is the file I am passing to my script using getopts.
This is working fine when I am invoking my script from the command line.
I want to invoke the same script by using oozie, but I am not sure how can I do it.
I tried passing the argument to the "exec" as well as "file" tag in the xml
When I am trying passing argument in exec tag, it was giving "JavaNullPoint" Expection
exec TAG
<exec>my_code.sh -F file_name</exec>
file TAG
<file>$/user/oozie/my_code.sh#$my_code.sh -F file_name</file>
When I am trying passing argument in File Tag, I was getting error, "No such File or directory". It was searching the file_name in /yarn/hadoop directory.
Can anyone please suggest how can I achieve this by using oozie?
You need to create a lib/ folder as part of your workflow where Oozie will upload the script as part of its process. This directory should also be uploaded to the oozie.wf.application.path location.
The reason this is required is that Oozie will run on any random YARN node, and pretend that you had a hundred node cluster, and you would otherwise have to ensure that every single server had /user/oozie/my_code.sh file available (which of course is hard to track). When this file can be placed on HDFS, every node can download it locally.
So if you put the script in the lib directory next to the workflow xml that you submit, then you can reference the script by name directly rather than using the # syntax
Then, you'll want to use the argument xml tags for the opts
https://oozie.apache.org/docs/4.3.1/DG_ShellActionExtension.html
I have created lib/ folder and uploaded it to oozie.wf.application.path location.
I am able to pass files to my shell action.

How to source a file via shell script

I wrote a shell script where I copy my .bashrc file as well as custom dotfiles to a backup folder and then replace them in my home folder with another .bashrc file which will then source my custom dotfiles.
However, after the script does its job, if I try to execute the aliases I included in the new files I get the error No command found. Only after I source the .bashrc file manually in the terminal I have access to them.
From what I understand, the script I'm running is executing in a sub-shell (?) which will terminate on execution.
How can I run the script and have new commands/aliases/functions available without having to source the .bashrc file myself or restarting the terminal?
Well, it appears that instead of running my script via sh script.sh, I can source it like source script.sh, which will behave exactly as I wanted.
Solution

How do I call a shell script which calls python scripts from a different folder?

Right now, I have shellScript.sh and test_me.py in a folder ABC/def. shellScript.sh calls test_me.py. I'm trying to call shellScript.sh from the ABC folder. So far, I keep on getting "No such file or directory" errors.
I've tried calling the python script from the shell script such as:
python /ABC/def/test_me.py
but this still gives me the same error.
How do I fix this?
Make sure your home directory starts by a capitalize H, if it does not (which is highly probable) your script won't work.
If the problem is not in the path or filename, then it could be in the way you are executing the shellScript.sh:
./shellScript.sh
might fix it provided you have the proper execute bit set on the script file. If not, try this:
sh /proper/path/to/shellScript.sh
If that does not fix it, then try to cd to the directory in the script before the python line:
cd /to/proper/folder
python test_me.py

How to run executable file in Apple Script

I'm trying to run a executable file using applescript in FileMaker.
I've been trying...
do shell script "./firstscript"
This results in the error "sh: ./firstscript: No such file or directory"
If I type './firstscript' directly in bash the file is properly being executed.
Any ideas on how I should be pointing to my executable file inside the apple script?
You probably have the wrong working directory - use a full path instead, e.g.
do shell script "/path/to/firstscript"

Resources