![]() Also, it’s always good to know multiple ways to do something. Both methods are useful, and both have their place. The benefit of doing it with an array like this is that you can easily get any word in the output, not just the first or last. In the section on “chain jobs” in our “Advanced Slurm” page you will find this very useful.Īs we saw in the section on variables, you can do this in a different way with parameter expansion. Now we can get the actual job ID by looking at element 3 (remember, elements start at 0). ), then made an array with each space-separated word in a separate element using ( ). We captured the output of the sbatch command using $(. $ name= "Janne" # This works: Bash understands "name" is a variable inside '$ 12345 Here is an example that sets a variable to “World!” then prints (using the “echo” command) “hello World!” to the screen (feel free to try this on a command line - the “$” at the beginning of the line shows this is a command you can type): Bash is text-oriented, so usually the values are strings. Let’s review it again.īash can use variables to hold values. ![]() We briefly covered the basics of variables in the introduction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |