Questions tagged [shell]
For questions relating to shells and kernels.
45
questions
-1
votes
2
answers
106
views
Delaying pods creation or recreating pods until tasks in other pods are completed
I need some help with better kubernetes resource deployment.
Essentially, I've 2 components. C1 and C2.
My task is to not deploy C2 pods or any resources until the tasks which are running in C1 are ...
-1
votes
1
answer
442
views
Local Path on Linux [closed]
As we all know /usr/local/sbin, /usr/local/bin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games and /snap/bin are directories that Linux commands ( Except ones that built-in to shell and custom ...
0
votes
1
answer
263
views
Are parser generators useful for parsing a shell language?
From my understanding, parser generators accept as input some form of context-free grammar description. The context-sensitive features are handled during semantic rather than syntactic analysis (...
0
votes
2
answers
218
views
Why not program our video text terminals/terminal emulators to use something JSON or XML on the backend instead of ANSI escape sequences? [closed]
Backstory (You can skip)
Awhile back I was developing a console toolkit for displaying debug messages and the like:
It gives me colour coding, blinking, underlines, bold, italic, etc.
While ...
0
votes
1
answer
169
views
Streamlining development process of Linux C++ CLI app [closed]
On Linux Mint 19 with C++ compiler version: g++-8 (...) 8.2.0
I am compiling and running my project named: getPixelColor
Using a shell script:
#!/bin/sh
g++-8 -std=c++17 -Wall -Wextra -Werror -...
-1
votes
1
answer
506
views
Shell Script does not capture values inside ENDSSH
I am very new to writing Shell scripts and am trying to write a simple script to run Vagrant up then SSH into the box and run some commands. The echo Hi there will run but the read -p will never show. ...
-2
votes
2
answers
143
views
How to call more than one program from a single process in an efficient way?
i want to call more than one process from the main program which is written in C++.
how to call them with the most efficient way given that one process may open and close more than one time.
the ...
50
votes
5
answers
10k
views
Is it a good idea to call shell commands from within C?
There's a unix shell command (udevadm info -q path -n /dev/ttyUSB2) that I want to call from a C program. With probably about a week of struggle, I could re-implement it myself, but I don't want to ...
2
votes
2
answers
2k
views
git clone vs cp -R
I want to use an existing project as a starting point for a new project by copying or cloning it.
There are at least two ways of doing this.
Method 1: Copy it.
cp -R /path/to/source /path/to/dest
...
2
votes
0
answers
189
views
Implementing redundant GIT backup scheme
I want to push a local repo to multiple remote GIT repositories to achieve redundancy in my backup scheme. So, let's say I plan to use Github and BitBucket to host my repositories.
I have two ...
1
vote
1
answer
479
views
Unit testing C code?
I learnt about the check testing framework today that seems good. This far I've scripted tests that uses valgrind so that the tests both display output from the tests and from valgrind. Is there a ...
2
votes
1
answer
2k
views
When to malloc and free?
Valgrind does not report a memory leak during my actual usage, only during my scripted test that I scripted with a shell script to test my own shell. I found that I didn't have to use malloc every ...
2
votes
2
answers
152
views
algorithm for shell language interpreter to find if a char is between quotes
Assume we have a string s (a C char *) that is a program in a language L. I want to parse L and know the following from the specification
The following characters must be quoted if they are to ...
-2
votes
1
answer
273
views
For loop and recursion for a new shell in C [closed]
I code a new shell in C, that could be done in several ways: Flex/bison, finite state machine, abstract syntax tree or just a tokenizer in C. Now I've written a for-loop that changes the condition of ...
3
votes
0
answers
724
views
Writing shell extensions in C#: What are the risks?
Raymond Chen said in 2006 and repeated in 2013:
Do not write in-process shell extensions in managed code
But I am perplex since there even is a library which is exclusively dedicated to writing ...
2
votes
2
answers
3k
views
How is possible for a program to write on the same line?
Many programs are capable to "rewrite" on the same line, not in a STDOUT way.
For example scp write the percentage or many installation programs will show you the nice rotating wheel.
How it works?
-2
votes
1
answer
1k
views
Why is Ruby's interpreter so small? [closed]
I noticed that the filesize of Ruby's interpreter seems suspiciously small.
I would have expected /bin/dash to be the smallest of all, but is 20x larger than Ruby:
Interpreter Bytes
-----------...
0
votes
2
answers
389
views
Is renaming an 'alias' for moving?
Is it true to say (on Windows and Unix\Linux\OS X) that renaming a file or directory is just an alias for moving?
e.g.
Are there any side effects to either which are not present on the other?
Does '...
1
vote
4
answers
1k
views
Executing scripts in parallel based on dependency tree
We have an app that is using a fairly simple stack (Linux, PHP, Oracle, Shell Scripts, etc).
We have a series of scripts that need to be executed:
/scr/app1/start.sh
/scr/app2/start.php
/scr/app3/...
2
votes
1
answer
532
views
One Script file or Multiple Script Files [closed]
I have a moderately long(for me at least) bash script file that that maintains a list of LAN users and the bandwidth each one uses. It is 199 lines with 11 functions and is already calling 3 different ...
9
votes
4
answers
12k
views
Why empty function are needed
I started learning Python and I am wondering why empty function are needed in a programming language.
e.g. in python:
def empty_func():
pass
Even in shell scripts empty functions are available.
...
2
votes
2
answers
284
views
Recreating files from shell script or java?
I have java application which takes a file, which is created by a process running on terminal. I start the process using a small shell script. Then run the Java application and it reads the file ...
-2
votes
1
answer
156
views
How can I have a shell script log into a remote server and execute imqcmd there? [closed]
I want to write a shell script to connect to the remote server and execute a command (any linux command).
I am using linux and want to prepare a shell script which can login to the virtual directory ...
0
votes
1
answer
112
views
How did the "abnormal" options in shell commands appear?
These options which obscure me are like
ps aux, route -ee, gcc -fPIC xxx, find . -name xxx and so on.
The examples above aren't comprehensive.
I.e., I don't think that the argument handle ...
0
votes
1
answer
308
views
using pre-commit / post-merge hook script to replace configuration values
I'm having some problem developing a web application with various developers, each one has an specific configuration to work.
and i would like to use the less resource cosuming approach to avoid that ...
1
vote
1
answer
374
views
Where does the tradition of shell prompts in code snippets come from?
Most code samples I see that demonstrate shell code preface each command with $. Having a prefix makes sense, but I'm confused as to why $ is used in particular. Some other symbol, like !, that can be ...
3
votes
3
answers
2k
views
Recommended guidelines for declaring bash/sh variables
I have been programming in BASH for a while now and the scripts that I write are starting to get more complicated.
I realized that I started to bring in some habits from C/C++ and wanted to get ...
1
vote
2
answers
299
views
is there a programming language designed to express data combinations? [closed]
Very often, when using the command line or just programming, you want to express some kind of combination that you end up using a for - which is often verbose.
for (int i = 0; i<10; ++i)
std::...
1
vote
3
answers
1k
views
What is the best way to store configurations of shell/script code to execute later?
I am working on a tool (Python, may or may not be important) that will allow a user to maintain a configuration file containing arbitrary shell and/or language code to be executed on particular events ...
10
votes
1
answer
9k
views
Is it possible to use python as a shell replacement? [duplicate]
Recently I was looking at python's shutil and subprocess etc... And I started wondering: wouldn't it be ok to use python instead of e.g. bash?
What am I missing?
1
vote
3
answers
6k
views
Which language is more suitable heavy file tasks?
I need to write a script (based on basic functions) to process /image/audio/video files. The process is mainly filesystem tasks and converts. The database of files has been stored by mysql. The script ...
1
vote
2
answers
638
views
DB API for shell scripting (any shell)
I am faced with some legacy shell scripts that run batch data processing jobs in Oracle using SQL+. For the most part, the data tier does not have to communicate back to the script with retrieved ...
3
votes
6
answers
946
views
Is it a bad practice to write shell script with many if-else statment and for loops?
I am maintaing several data process shell scripts which are full of if-else statements and for loops . I try to make the scritps tidy and easy to debug.
When I read some suggestions about shell code ...
43
votes
4
answers
34k
views
Difference between a REPL and interactive shell
Noob question. I am not quite able to tell the difference between a REPL and an interactive shell just by reading the definitions on Wikipedia.
Wiki notes that REPL is a particular kind of ...
13
votes
3
answers
3k
views
User Configuration of a Shell Script. Best practices?
I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. ...
4
votes
1
answer
3k
views
Why would I want to use CRaSH?
Justed stumbled across CRaSH and although it looks mighty interesting, I'm wondering why a Java developer should invest time & energy into learning (yet another) shell language. What sort of ...
4
votes
2
answers
334
views
Are "backwards" terminators for if and case unique to shell scripting?
In bash at least, if and case blocks are closed like this:
if some-expr
then
echo "hello world"
fi
case $some-var in
[1-5])
do-a-thing
;;
*)
do-another-thing
esac
as opposed to the ...
5
votes
2
answers
5k
views
Why most use Cygwin and not Uwin?
Most academic researchers I know target just *nix, and rely on Cygwin to make their applications available on Windows. I have tried many of these projects and always found them too unstable for ...
0
votes
3
answers
2k
views
How to set-up a simple subversion workflow
I am trying to set-up a simple SVN workflow at home. I am new to subversion (and programming) so I have been reading the official PDF documentations but still not sure about how to set-up my ...
17
votes
8
answers
13k
views
What's shell script's advantage over interpreted programming languages? [closed]
(I'm not sure if it's a appropriate question here)
Shell scripts, like those written in bash, can do many things. They can call Unix programs, pipe their output, redirect I/O from/to files, control ...
4
votes
1
answer
2k
views
Why no more macro languages?
In this answer to a previous question of mine about scripting languages suitability as shells, DigitalRoss identifies the difference between the macro languages and the "parsed typed" languages in ...
19
votes
9
answers
4k
views
What were the reasons why Windows never had a decent shell? [closed]
I was reading a topic on SO: Why are scripting languages (e.g. ...) not suitable as shell languages?. Especially I liked the answer by Jörg W Mittag, from which I learned interesting things about ...
20
votes
12
answers
15k
views
Interviewing someone for general unix skills [closed]
How would you test a developer that claims to have *nix shell experience (just to be clear, we don't want to test if someone can develop on *nix, only that they know their way around the command line)....
5
votes
2
answers
2k
views
Functional programming: Writing a small interpreter
I'm working on a small Unix shell, and am contemplating the idea of writing a script interpreter. While reading about the subject I inevitably hear of functional programming, lambda calculus, and find ...
0
votes
3
answers
178
views
Shell independence in programming groups
Our programming environment is dependent upon certain environment variables being set. For example, to use distcc, one needs to define the DISTCC_HOSTS environment variable. The way we handle this is ...