logo
down
shadow

Pass command line arguments via sbatch


Pass command line arguments via sbatch

By : ivs
Date : November 21 2020, 07:31 AM
this one helps. The lines starting with #SBATCH are not interpreted by bash but are replaced with code by sbatch. The sbatch options do not support $1 vars (only %j and some others, replacing $1 by %1 will not work). When you don't have different sbatch processes running in parallel, you could try
code :
#!/bin/bash

touch outFile${1}.txt errFile${1}.txt
rm link_out.sbatch link_err.sbatch 2>/dev/null # remove links from previous runs
ln -s outFile${1}.txt link_out.sbatch
ln -s errFile${1}.txt link_err.sbatch

#SBATCH -o link_out.sbatch
#SBATCH -e link_err.sbatch

hostname
# I do not know about the background processing of sbatch, are the jobs still running
# at this point? When they are, you can not delete the temporary symlinks yet.

exit 0
cat  exampleJob.sh.template | sed -e 's/File.txt/File'$1'.txt/' > exampleJob.sh
# I do not know, is the following needed with sbatch?
chmod +x exampleJob.sh
#SBATCH -o "outFile.txt"
#SBATCH -e "errFile.txt"


Share : facebook icon twitter icon
How to pass arguments (not command line arguments) to functions within batch scripts

How to pass arguments (not command line arguments) to functions within batch scripts


By : legendh
Date : March 29 2020, 07:55 AM
this will help I'm writing a batch file for automating the creation of typical folder structures for products that we sell. I would like to be able to call my batch file with 2 optional arguments; the name of the supplier and a file for creating lots of folders at once. If no supplier is supplied the script asks via standard input who the supplier is. If no file is supplied the script asks for the name of the folder you wish to create. If a file is passed as an argument I would like the script to read the file line by line and create a folder for each line, named after the contents of that line. Here is the :readFile function: , I rebuild the file and it worked
code :
@echo off
set "supplier=C:\temp\supp\"
set "product=Car"
echo test1,myComment,myValue > myFile.txt
call :readFile "myFile.txt"
EXIT /B

:readFile
echo "Reading from file: %~1"
FOR /F "usebackq delims=," %%a IN ("%~1") do (
    call :makeFolder %%a
)
goto:EOF

:makeFolder  
if "%1"=="" (
    set /p product="Enter product name: "
) else (
    set "product=%1"
)
if exist "%supplier%\Products\%product%" (
    echo(
    echo The folder '%product%' already exists.
    echo(
    goto:EOF
)
echo "%1"
echo mkdir "%supplier%\Products\%product%\Images\Web Ready"
echo mkdir "%supplier%\Products\%product%\Images\Supplied"
echo mkdir "%supplier%\Products\%product%\Images\Edited"
goto:EOF
PyQt4 `QCoreApplication.arguments()` returns 'unknown' when I pass non-ASCII command line arguments

PyQt4 `QCoreApplication.arguments()` returns 'unknown' when I pass non-ASCII command line arguments


By : Al Janzeer
Date : March 29 2020, 07:55 AM
With these it helps The encoding for QApplication is Latin-1, and you need it to be UTF-8.
To get around this, you may manually encode the arguments using .encode('utf-8'), before passing them to QApplication.
Can CVS repository commit command pass command line arguments to the files?

Can CVS repository commit command pass command line arguments to the files?


By : HarlemWriter
Date : March 29 2020, 07:55 AM
may help you . First hint: keyword substituion
If you just want version numbers or commit time - CVS has something that enraged Linus Torvalds so much he started to design git: it can change your files on commit. See for example $Id$ and others at this MIT doc page.
TCL - Call a proc with command line arguments not knowing the number of arguments to pass

TCL - Call a proc with command line arguments not knowing the number of arguments to pass


By : Tom Hart
Date : March 29 2020, 07:55 AM
this one helps. In all currently-supported versions of Tcl, you can use the expansion “operator” (it's not an operator in a technical sense, but you can pretend it is) to convert a list into multiple words, one for each list item. Since argv is a list already, your command becomes:
code :
dll_interface {*}$argv
eval [linsert $argv 0 dll_interface]
How to pass an argument in the sbatch command line?

How to pass an argument in the sbatch command line?


By : Paras Deshpande
Date : March 29 2020, 07:55 AM
hop of those help? You can pass an argument after the script as if you were running it directly on the shell like this:
code :
sbatch --partition normal --array 1-10 RHO_COR.sh name_of_my_file
Related Posts Related Posts :
  • Security of su root in bash script
  • how to replace a string at a specific position in a csv file using bash
  • how to delete duplicate lines in a text file in unix bash?
  • Compare a variables in bash
  • How do I use sed on a string?
  • Using bash variables for range in sed
  • convert a DURATION HH:MM:SS to seconds in bash
  • Shell make system paths click-able when printed out by my shell script
  • I want to use parallel-ssh to run a bash script on multiple servers, but it simple prints the echo statements
  • AWK between 2 patterns - first occurence
  • Nginx on docker - daemonize and attach to bash
  • Delete or Replace nth line in a file after a pattern match using shell scripts
  • Actual return code for SCP
  • How to exit a bash function that expects a return
  • Bash script to split file into two files while changing output file during processing
  • variable substitution (what do you call/name this method)?
  • Call function from another shell script
  • How to Grep and Replace With Exclusions
  • shell command to remove characters after a special character in bash/shell
  • How do I run a script for 1st working day of every month in cron?
  • Bash Unexpected End of File Error After Installing RVM
  • Nested Loop with increment on inner loop?
  • video orientation detection in bash
  • Interrupt sleep in bash with a signal trap
  • Want file rename script to add number at end with fixed length
  • What's the DRYest way to replace a file with a symlink in bash
  • How to run Bitcoin's autogen.sh file?
  • Renaming files in folder and subfolders using a list- Bash Script/Unix
  • Bash command to compare more than two files
  • If It is a directory append text
  • What's wrong with my WHILE-DO loop, or why my script can't find the file I'm giving it on a plate?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org