![]() ![]() ![]() In the end, my shebang looks like #!/usr/bin/pil -argv dummy len bind the first argument (path to script) to dummy second argument to len len isn't actually going to be loaded because (bye) has been called before its loading starts. This means I can't pass another "-" argument to pil The problem is, it can only pass one argument: everything after the space in the shebang is passed to the program as $1 in shell notation. The shebang tells the kernel to pass this file to the specified program, like #!/bin/bash It can also pass an argument to the program, for instance, #!/usr/bin/pulseaudio -nF in some PulseAudio config files. srand(expr) Uses expr as a new seed for the random number generator. There's just one problem: I have to write this command in the shebang. buffer, compares it against the search string, and if the comparison passes. Using cat /dev/urandom was making my application hang since this file. This would've been the solution: pil -"argv dummy dummy len" random-string - 60 would bind dummy to "random-string", then to "-", then len to "60", after which it'll load my script where len is available. In this specific case I had to generate a random string with 4096 bytes programmatically. If pil sees an argument that's just a "-", it'll stop loading subsequent arguments as files. For example, -bye runs (bye) immediately, exiting the program -argv dummy len runs (argv dummy len) which binds the first command line argument to dummy and second to len but those arguments are still going to be loaded as files. Pil reads command line arguments starting with a "-" as a function to run or, more specifically, as a form to evaluate after wrapping it in parentheses. That seemed unstatisfying to me (I don't know why now that I've realized how hacky this next solution is), so I went with a hack to bind the first command line argument to a variable in the script. There are two ways around this: one is to simply wrap the whole thing into a shell script, and handle arguments there. This becomes a problem when the whole point of the script is to be a shell command. The interpreter itself processes arguments as files to load or functions to invoke. In fact, you do not even need to use dd here. The problem starts here, and is related to this 256 byte limit. Let's look at each of the commands: dd if/dev/urandom bs256 count1 2> /dev/null This will read a single 256 byte block from /dev/urandom, a cryptographically secure random source. In Picolisp, command line arguments can't be accessed directly in the program. 1 Answer Sorted by: 26 No, it's not entirely secure. Is there a way to get a 'random' number (one that would be the same in every instance) given a string I would like to do this in bash. I first saw Picolisp because it is currently (as of 2018-10) the only Lisp family language packaged in Termux. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |