Questions tagged [interpreter]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
78 views

Does the shell script interpreter optimize if else chains?

As far as I understand, an interpreter runs code line by line; but I find probable that my reasoning is incorrect. If in this example case the first if line returns true, will the program know to skip ...
user avatar
-1 votes
1 answer
30 views

Is it correct to divide parsing into simple and complex? [closed]

I understand "field splitting" (or alternatively "word splitting") as a possible part of a broader process named parsing, while field splitting is done on parsing in various shells ...
user avatar
0 votes
2 answers
118 views

Why two or more read commands cannot be executed in one go (without some separation syntax)?

I tried to copy-paste the following two commands into the terminal directly and to then execute them: read -s x read -s y Current output is empty prompt but desired output is the first read execution ...
user avatar
  • 9
0 votes
3 answers
787 views

Switch the default shell by another interpreter

So I have some experience with linux and I was always wondering if it is possible to modify the terminal so that it executes a different interpreter (like python) rather than the default shell ...
user avatar
  • 3
0 votes
3 answers
127 views

bash line interpreting process

I would like to understand the exact process of line interpretation executed by bash. from GNU bash reference manual: When a simple command is executed, the shell performs the following expansions, ...
user avatar
2 votes
0 answers
116 views

How to trace script execution events

My goal: To receive events from the kernel when a file/script is opened for execution with the absolute path of the file (or maybe the working directory, to resolve the absolute path of the file). I ...
user avatar
2 votes
1 answer
622 views

Why " >/dev/console" for remote beep (echo-command)

I've learned that this command: echo -e "\a" triggers a beep on the local system, whereas this command: echo -e "\a" >/dev/console triggers a beep on a remote system. Why is this? What is the &...
user avatar
4 votes
3 answers
559 views

Who runs the interpreter for files that are execute-only?

If the current user only has execute (--x) permissions on a file, under which user does the interpreter (specified by #!/path/to/interpreter at the beginning of the file) run? It couldn't be the ...
user avatar
  • 231
0 votes
1 answer
266 views

What's the purpose of having "env [shell]" as an interpreter? [duplicate]

I already stumbled over #!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an env command, i.e. why not just ...
user avatar
7 votes
3 answers
347 views

Is parsing scripts at script-runtime ubiquitous to shells or present in other interpreters and how does that work?

I had always thought that shells parse whole scripts, constructing an AST, and then execute that AST from memory. However, I just read a comment by Stéphane Chazelas, and tested executing this script, ...
user avatar
  • 4,191
1 vote
1 answer
2k views

Building "cross linux system" programs, with different libc/musl interpreter

My goal is simple: I would like to create a program that bootstraps the nix package manager on any architecture, as a non-root user, with as few depends as possible. For now, what I did is the ...
user avatar
  • 2,228
3 votes
2 answers
1k views

xslt shbang: Using xslt from the command line

I have (foolishly?) written a couple of moderately general-purpose xslt scripts. I'd quite like to turn these into executables that read an xml document from standard in or similar. The way you do ...
user avatar
  • 1,066
19 votes
6 answers
8k views

Choose interpreter after script start e.g. if/else inside hashbang

Is there any way to dynamically choose the interpreter that's executing a script? I have a script that I'm running on two different systems, and the interpreter I want to use is located in different ...
user avatar
  • 429
6 votes
6 answers
5k views

Run program at lower CPU speed?

It would be very useful for me to run specific programs in a Linux environment with a fixed (lower) CPU clock speed (say, runat 400mhz ./my-program --argument-of="my program" for getting that clock ...
user avatar
6 votes
1 answer
1k views

Perl and Python wrongly interpreted via shebang on Linux

All my Python and Perl scripts are simply NOT iterpreted via shebang. Never. But they work as expected when I explicitly call the binary. I double checked my Perl and Python installations, it is ...
user avatar
  • 63
4 votes
2 answers
7k views

Specifying a generic interpreter for a program like expect?

I am writing expect script which can be used on mulple operating systems but the problem is i can't use #!/usr/bin/expect evreywhere so instead i tried to do #!`which expect` at the top but it ...
user avatar
  • 7,261
0 votes
2 answers
547 views

can something besides the shebang set the interpreter? [closed]

I'm running a script (in tmuxinator) that tries to source another script (rvm). rvm explicitly does not allow sourcing from sh. I didn't think that would be a problem, because the shebang in the ...
user avatar
  • 101
1 vote
3 answers
940 views

Is shebang always the same as the interpreter's installation directory?

Must the shebang header always match the interpreter's installation directory? If so, then why do both #!/usr/bin/python and #!/usr/local/bin/python work for me?
user avatar