Questions tagged [programming]

Questions about tools for programming (compilers, IDE, etc.) For questions that involve programming, ask on Stack Overflow.

Filter by
Sorted by
Tagged with
0 votes
4 answers
76 views

Scoring from input in Bash

Can you help me please? I have a task. I have from input some text with numbers. For example: beta 1 score 9 something 2 beta 4 something 1 I need to calculate all numbers with the same ...
user avatar
1 vote
1 answer
42 views

Linux mint - classify an application correctly in the start menu

Mint auto-classifies applications into categories in the start menu. I use this classification to navigate apps more easily. Recently I have installed Eclipse IDE and Mint failed to classify it as &...
user avatar
  • 111
-1 votes
2 answers
87 views

What does it mean to both append and prepend a value to a variable (in fish shell or in general)?

Per the fish shell documentation for the set command: append: causes the values to be appended to the current set of values for the variable. This can be used with --prepend to both append and ...
user avatar
0 votes
0 answers
36 views

XDP_REDIRECT detail

Can XDP_REDIRECT forward packets to an interface with speed different than ingress interface? More precisely, if ingress interface speed is 100 Gbps and the egress interface speed is 10 Gbps, the xdp ...
user avatar
0 votes
1 answer
39 views

Remove null variable name and value both while echoing in a single string

i have the below condition where values are as below. emp_name="Sid" emp_id=1234 emp_hobby="" emp_likes="swimming" emp_dislikes="" emp_summary="emp_name:$...
user avatar
  • 3
0 votes
1 answer
70 views

What is lsh_ used for and/or what is it doing?

I am new to programming in Linux and I am quite confused. I notice the lsh_ prefix is used for function names here. I'm not sure why. The only thing I can find on the internet is that lsh could ...
user avatar
2 votes
1 answer
180 views

get event when user has selected a text in any window in X11

I want to write an app that shows a popup-menu after a user has selected a text in any window in Linux (debian based). Mac users may know "PopClip" (https://pilotmoon.com/popclip/) and as I ...
user avatar
  • 31
0 votes
1 answer
108 views

Bash script printing expression instead of result

I am trying to calculate multiplication of number of arguments and first argument provided by the customer. here the arguments are 10, 15 so total number of arguments is 2. Now i want the shell to ...
user avatar
1 vote
1 answer
29 views

Ensuring only 1 mandatory parameter is passed to script

I am writing a shell script and new to getopts for parameter parsing. What I have are 1 optional and 2 mandatory parameters and what I want to do is ensure that only one mandatory parameter is passed. ...
user avatar
  • 13
1 vote
1 answer
36 views

how to repeat values of B variable till number of A variables are finished

I have infile with values for 2 variables # cat infile A 1 B 2 C D E I want to read variable a & b, so that if $b has null value, it should repeat like 1..2, till all $a values are read. so if I ...
user avatar
  • 1,591
1 vote
2 answers
416 views

Missing header file linux/io_uring.h

#include <linux/io_uring.h> main.c:1:10: fatal error: linux/io_uring.h: No such file or directory #include <linux/io_uring.h> ^~~~~~~~~~~~~~~~~~ Kernel version 5.4.0-80. I ...
user avatar
-3 votes
1 answer
47 views

Linux distribution with most programming tools installed [closed]

Which is the Linux distribution with the greatest number of programming languages and tools installed by default?
user avatar
  • 371
1 vote
1 answer
389 views

How to reposition the elements of a json array conditionally using jq?

I want to re-position elements of an array (change index of array elements) based on a condition. I don't know how to translate this to jq which is more of a functional language. Basically I want to ...
user avatar
1 vote
1 answer
332 views

How to generate thumbnails/previews for files?

I wrote an app for Windows and macOS and I am in the process of porting it to Linux. My app has a file browser implemented and can display thumbnails or document icons of files. On Windows I get ...
user avatar
0 votes
1 answer
36 views

How to make a script which create a file with the info i want?

i'm a newbie on Linux here and i was hoping to find help. I was using Centos and i've found an exercise where i have to create a script. This script should create a text file with the network ...
user avatar
0 votes
2 answers
521 views

Printing to the STDOUT vs writing to an output file directly [closed]

Is there any rule of thumb when the result of the program should be printed to the stdout by default, and when the more appropriate approach is to accept output file as one of the arguments and write ...
user avatar
  • 162
0 votes
2 answers
56 views

using command subsitition in a bash for loop

I am probably making an obvious mistake but I could use a strong hint:-) for file in *; do ls $file | var=$(ls $file | grep -Eo '.{18}$' | cut -d '.' -f1 |sed 's/.\{12\}/&./'); echo "var is $...
user avatar
-1 votes
1 answer
43 views

LXML Clarifications... Pretty, but complicated!

I have only recently met this lib and the first impact was not pleasant at all! First of all, from this site https://lxml.de/ I don't know about you, but I didn't understand anything! Too complicated ...
user avatar
0 votes
1 answer
73 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
-3 votes
1 answer
42 views

Perl having problem in programme execution [closed]

#!/usr/bin/perl #Script:name2.pl - Demonstrates use of chop # print("Enter your name:"); $name=<STDIN>; $lname = chop($name); #Removes newline character from $name ...
user avatar
0 votes
1 answer
138 views

Flip-flop in shell

In Wikipedia there are two relevant articles about the term "Flip-flop": Flip-flop (electronics) Flip-flop (programming) I think that there is a formal-logic common denominator between the ...
user avatar
0 votes
2 answers
60 views

awk to vlookup and print

I got a comma-separated file # cat data smartplayer,2222,off smartplayer,1111,on scorer,0000, I want to search for smartplayer in $1, get its state from $3 and print like this off-smart-player 2222 ...
user avatar
  • 1,591
1 vote
0 answers
49 views

Convert jpg to bmp in an ARM Cortex M4 MCU

I'm currently working in a project that involves the use of an ARM cortex M4 MCU, specifically STM32F429, which has an embedded LCD controller which uses the bmp image format to show the images in the ...
user avatar
0 votes
2 answers
319 views

Locating the C header "stdio.h"

I wrote my first C program which is the generic "hello world" program. Could anyone please tell me where can I find stdio.h file in my system? It will help me a lot in understanding of the ...
user avatar
0 votes
1 answer
25 views

How does many binaries changes the percent number of the execution in its right place?

I'm trying to write a C program which can do the thing that many binaries such as package managers do in execution time. They change and add to the already outputted texts in terminal and it makes it ...
user avatar
  • 47
1 vote
0 answers
65 views

How can I listen to port creation events on a network interface?

I would like to create a TUN interface (following this tutorial) that takes specific actions when a listening port is created on it. Those include logging the application that created the port, which ...
user avatar
2 votes
1 answer
70 views

Pipes and graphics

When developing a program (in C or Python, say), I often write debug messages to see whether my program behaves as intended. On Linux, such text messages can be handled in varied and flexible ways ...
user avatar
  • 121
0 votes
0 answers
33 views

How do programs accessing symbolic links differ from users? (What scenarios can break by replacing a file with a symbolic link?)

I think I understand what soft and hard symbolic links are, but I'm not sure how programs access them (as opposed to me, a user). For example, I want to replace my ~/.bashrc with a symbolic link that ...
user avatar
0 votes
2 answers
2k views

How to get into python environment and run some python commands and return to normal terminal using shell script

Sorry about the title it may not be clear. Here is the complete explanation of my doubt. I am writing the below shell script and expecting the mentioned output. #!/bin/bash python3 print("Hello ...
user avatar
1 vote
1 answer
57 views

"Pinging" using DNS protocol

Is there accepted "good practice" for checking that the network connection to a DNS server is operational, and that the server responds minimally, other than issuing a lookup request? ...
user avatar
0 votes
0 answers
146 views

End process but resume bash script?

I am trying to create a script in which part of it runs a command that can only be stopped by the user sending SIGINT to the process. I want the user to be able to press Ctrl+C to end that part of the ...
user avatar
  • 11
1 vote
0 answers
25 views

How to give stdout to different program on same line? [duplicate]

I could do it long way i.e cat hi.txt | grep 'important url' > imurl cat hi.txt | grep -v 'not important url' > imnoturl cat hi.txt | otherprogram1 cat hi.txt | otherprogramN However, is there ...
user avatar
0 votes
0 answers
55 views

how to use plantUML after installing PowerTools?

On the understanding that PowerTools includes plantUML I've installed and enabled the package. How do I now invoke plantUML to use it? (Although I now realize that the above link is actually for ...
user avatar
0 votes
1 answer
107 views

How to configure flatpak on CentOS?

I don't believe flatpak is configured: $ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 8.2.2004 (Core) Release: 8.2.2004 ...
user avatar
0 votes
0 answers
129 views

Execute shell commands ubuntu in Python

I'm currently studying Automation and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are: install = os.system("...
user avatar
0 votes
1 answer
473 views

How to start Jetty using start.jar from the console?

Having installed Jetty through apt how do I start the web server to get to a welcome page? Trying: java -jar /usr/share/jetty9/start.jar results in: ERROR : Nothing to start, exiting ... Usage: java ...
user avatar
0 votes
0 answers
15 views

mathematica in Konsole can't access last input with keyboard

Here is my configuration :-------------------:: ----------------------------- :-----------/shhOHbmp---:\ OS: Fedora 32 (Thirty Two) x86_64 /-----------omMMMNNNMMD ---: ...
user avatar
  • 300
0 votes
1 answer
45 views

Is PackageExport a command in Linux?

Does anyone know if PackageExports is a command in Linux? or where can one install its package? When I tried to install the package SemidefiniteProgramming, to Macaulay 2, in Gnu/Linux, I always get ...
user avatar
  • 1
1 vote
1 answer
3k views

Get current screen dimensions via Xlib using C

Is there any way to get screen dimensions of a display via Xlib using C? I've tried referring to the X.org docs (https://tronche.com/gui/x/xlib/display/screen-information.html), and it only gives me ...
user avatar
0 votes
1 answer
219 views

detect cms from list

my marketing department wanted from me detect our domains for that if they use Wordpress. I have our huge list of domains, but I can't find proper cms detector which will just save which domain has ...
user avatar
  • 338
0 votes
1 answer
27 views

Multiple tcp scanning tools integration

I recently started my first programming project that consist of purpose multiple tcp scanning tools integration for multiple usage. To be more clear, I want to incorporate NMAP and MASSCAN tools. But, ...
user avatar
0 votes
1 answer
40 views

Which programming lang.s are used for ui of os? [closed]

Which programming languages are used for the part of the os which user interacts with (the application?), for instance the task bar (on linux ,macosx or windows), start button, desktop etc. ?
user avatar
  • 3
0 votes
1 answer
3k views

Simple shell loop fail in Makefile

Why does the shell loop l='abc de f'; for k in $l ;{ echo $k; } inside Makefile not work ? instead only give abc de f at once How to solve such in the definitive way?
user avatar
0 votes
1 answer
1k views

How to exit from an external program with a bash script?

Im working within an external program and I need to exit the program from a bash script that I will produce on the fly. So, in the external environment if I do exit it exits. Although if I do, ...
user avatar
1 vote
1 answer
271 views

How do I pass commands to an external command, from bash?

I would like know if it is possible to enter in an external program and give commands from a bash script. As an example, lets imagine the external program is ipython and I want to give the commands ...
user avatar
0 votes
1 answer
205 views

Bash Script Time each function and Time total Script Execution Duration

I've written a bash script and would like to implement a timer that will also get the total time of the scripts execution duration and also the time that each loop iteration takes. For example, in the ...
user avatar
3 votes
1 answer
219 views

How to extract function comment using sed?

I want to implement a simple utility that would take a C source file and a name of a function, struct, enum or whatever and output the comment directly above the element if present. Ie. /* This is ...
user avatar
  • 169
-10 votes
2 answers
114 views

Error Shell Programming in Linux [closed]

I need to fix my code? i=0; bil_genap=0; bil_ganjil=0; echo -n "Batas loop : "; read batas; if [ -z $batas ] | [ $batas -lt 0 ]; then echo "Ops, tidak boleh kosong atau Batas loop ...
user avatar
  • 3
7 votes
1 answer
3k views

Command-line diff tool

So we all have the diff command installed by default. I certainly don't know how to use it well. But I would expect some reasonable default usage. But when I type diff file1 file2 I get ... a text ... ...
user avatar
  • 2,633
0 votes
1 answer
620 views

What is the highest level of indentation today and has ever merged into the Linux Kernel? [closed]

I was recently reviewing the Linux kernel coding style guideline, and this got me thinking: 1) Indentation Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic ...
user avatar
  • 183