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
2answers
63 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?
-1
votes
1answer
61 views

Replace numbers in one file with names from another file

I have a file where numbers correspond to names. I need to make changes in the second file such that the numbers are replaced by names Example in 1st file 1 K 2 J........ Second file 1 2 3 4 I ...
0
votes
1answer
116 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, ...
1
vote
1answer
46 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 ...
0
votes
0answers
16 views

Why a result from history command doesn't behave in a bash function? [duplicate]

I started learning bash script recently, and I got stuck with this situation. I want to use a result from history command for some purpose. First, I tried to extract the 2nd column (command name) ...
0
votes
0answers
16 views

AVRPROG Don't recognize my avr programmer( myAVR mySmartUSB light)

I need to install one avr programmer ( myAVR mySmartUSB light)) like this : into my linux OS, so i tried to install it via Eclipse by this instructions,when i run sudo avrprog i get this output : ...
0
votes
1answer
35 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 ...
0
votes
0answers
14 views

Wine has no internet connection or my app does not run

So i made a small 500 line app. When i run my.computer.network.ping ("www.google.com") or https google .com it prints the no internet connection warning that i have set up when this command fails. ...
0
votes
0answers
16 views

Kernel driver serving multiple virtual file readers

There is a kernel driver that collects data from some external hardware and passes all data to a virtual file if a reader reads this file. Data blocks are appended to a list with the assumption the ...
3
votes
1answer
53 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 ...
-8
votes
2answers
89 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 ...
2
votes
0answers
105 views

Good projects for bash and awk [closed]

I am learning bash and awk programming, and have gotten to the point where I want some interesting projects to work on to improve my programming. At the minute, the beginner stuff is getting too easy, ...
5
votes
1answer
726 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 ... ...
-1
votes
1answer
237 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 ...
1
vote
1answer
320 views

Can you edit address values in “/proc/$pid/mem” to reflect changes in that process?

I would like to see if I can edit a value in my program while it is running by directly changing the memory. My thought process (untested) is to do the following: Run the program. Open up "System ...
1
vote
1answer
138 views

Is Linux a suitable platform for learning COBOL? [closed]

I am studying a college CIS degree. Next semester, I have a choice of either studying JAVA and COBOL or JAVA and PHP. I don't know much about COBOL and only have computers with Debian. The textbooks I ...
0
votes
2answers
404 views

Is there something similar or like “pass” in python in bash/shell programming?

I sometimes need a command like pass in Python in my bash scripts. Like: if grep something then pass else code fi In Python you have: >>> for element in a: ... if not element: ...
1
vote
1answer
79 views

The $@ variable is not working in a for loop, trying to iterate through a users list

PROBLEM: I can't get the $@ variable to do what I want in a for loop, the loop only sends one name into the file while looping, it should loop through all the arguments and write them to the file ...
1
vote
2answers
787 views

checking if iptables are set on a system in script [duplicate]

I'm writing a script in bash and I need to check if iptables are set...I have this: if [ `iptables-save | grep '^\-' | wc -l` > 0 ] then echo "Iptables already set, skipping..........!" else ...
0
votes
1answer
710 views

How to pass argv arguments to a C program using a file or python script in linux?

I used to be able to pass input to C program by first writing a python script and using pipe to send it to the C program as an input or write the output of python script to a file and just doing r &...
2
votes
2answers
1k views

Getting access to a variable inside a sudo clause in a script with EOF

PROBLEM: I need to have a variable here called $user: chown $user:$user "$HOME"/.bashrc but it doesn't have access to it from outside the sudo and EOF: for user in "$@" do if [ "$user" = root ]...
1
vote
1answer
71 views

why $($var) gives an error?

I am trying to execute the following code in shell but I am not getting the output as expected. The command is as follows: i=1 echo $($i) I am getting an error: Command not found error I think it ...
0
votes
2answers
45 views

How to have access to script variables and environmental variables inside a sudo/EOF clause in a script…BASH

PROBLEM: I am struggling with this cp always giving errors because the variables not there... Here is my code: if [ ! -z "$USER1" ] then sudo -u "$USER1" bash <<'EOF' sleep 5 ...
2
votes
1answer
214 views

sudo -u user bash works but $HOME is not changing accordingly

I'm writing a script to setup new debian install's. The problem is in this code: if [ ! -z "$USER1" ] then sudo -u "$USER1" bash <<-EOF cp "$BASHRC $HOME"/.bashrc wget https://raw....
1
vote
0answers
60 views

Fakeroot on macOS tries to delete system directories

I’m having a problem with fakeroot on macOS. I created a pacman fork. When I’d like to delete a package, pacman tries to delete /usr/ instead of a subdirectory. On Linux, it is working fine, though. ...
1
vote
1answer
35 views

vi with files/directories on the side?

I'm wondering if there's a plugin or a way to make vi/vim have collapseable folders/files on the left side like a regular IDE.
0
votes
0answers
128 views

How to install HTML5/JavaScript to Netbeans?

I installed the NetBeans Connector plugin to Chromium on my MacBook. That worked perfectly. I could create new projects in HTML5/Javascript. I tried to do the same on my Linux Mint 18.3 computer. But ...
1
vote
1answer
133 views

LibreOffice placeholder fields documentation

I have to modify a LibreOffice template with a number of conditional statements. I managed to figure out one can add such statements through Insert > Fields > More fields, tab Functions, type ...
5
votes
4answers
24k views

How do I run .c file from the command line [duplicate]

I am beginning to work with micro controllers and programming them using C language. All my programming experience is with Python language. I know that if I want to test a script I have written in ...
23
votes
6answers
4k views

Is it possible for a program to get number of spaces between command line arguments in POSIX?

Say if I wrote a program with the following line: int main(int argc, char** argv) Now it knows what command line arguments are passed to it by checking the content of argv. Can the program detect ...
3
votes
1answer
338 views

How to organize 3rd-party libraries for Python?

I am new in Python. I want to install many 3rd-party libraries (I think they are also called packages?) like, for example, "AstroPy". But I am not sure where the new source code will be stored (I mean,...
1
vote
3answers
2k views

How can I make my Linux server sleep and wake on LAN when not in use?

I have recently purchased myself an HP rack server for use as a personal fileserver. This server currently lives under my bed as I have nowhere else to put it. For those not aware (as I was not ...
-2
votes
1answer
52 views

Remove the gap pattern from files [closed]

I want to remove gaps (-). if gap found continuous >10 in all >Tem at the same position then remove the all gaps and also remove the sequences or gap from the query at the same position which are in ...
4
votes
2answers
2k views

Writing C# in Debian

I want to learn C# on a Debian system. What do I have to install? Is there something like an interactive prompt where I can try running snippets of code? I have to learn C# and I have a dual boot ...
0
votes
1answer
46 views

How to output the display from an application to a vnc viewer? [closed]

How to I write a program on a machine with a high end graphics card and a desired platform so that other computers on a network can view the video output of the program on a separate monitor? Like ...
1
vote
2answers
9k views

sh: 1: program not found

I have written a script to execute files one by one by calling a installed program. The same program is executing from terminal, like procheck abc.pdb, then it's working fine. But when I execute this ...
1
vote
0answers
405 views

how to get dark theme or look for netbeans?

Not quite sure how to get dark themes for Netbeans: would like something similar to this look: just without the "side" window.
0
votes
2answers
57 views

netbeans has preview tile or window — how to remove that preview?

How I get the "preview" window on the far right hand side to minimize or disappear? so that the class extends fully to the right hand side.
0
votes
1answer
21 views

Having multiple computers on network access file?

Say I have a program being run on multiple computers all on the same network (and all on the same account). Every once in a while the program needs to read/write a file save.dat. The actual file ...
1
vote
0answers
708 views

High iowait while the throughput and IOPS are low

I'm new to programming & Linux. After I finished my programs(do some IO), I found iowait is very high(~65%) while the throughput(~5M/s read + ~5M/s write) and IOPS(50~100 QPS) are low. iostat -...
0
votes
2answers
440 views

What was the reason for lseek function to return file descriptors as long integer? [closed]

According to the book Advanced Programming in the Unix Environment :- "The character l in the name lseek means ‘‘long integer.’’ Before the introduction of the off_t data type, the offset argument ...
0
votes
1answer
932 views

distribute the JVM across a cluster of machines

Grasping at straws for search parameters and terminology. The key attribute to the JVM is the V for virtual (at least within the context of this question). How do you span a JVM across a cluster of ...
-1
votes
1answer
61 views

How Mount a datastore on linux in python [closed]

I need to mount xyz/pqr/ datastore on my linux mychine for in my python script.
1
vote
1answer
540 views

The most used language for Debian [closed]

What is the programming language mostly used to develop most parts of the Debian?
2
votes
2answers
891 views

How to get a list of all installed programming languages on arch linux / any linux? [closed]

Is there a way to check what programming languages are installed on a given Linux system? For example, I have recently installed Arch Linux on my host and just for informational purposes I would like ...
-1
votes
1answer
603 views

Shell script to move files and rename it with index [closed]

Consider two directories A and B. A contains a text file A.txt which changes its contents every 3 seconds. The shell script is to move A.txt to directory B and rename it to A_1.txt. After 3 seconds ...
20
votes
7answers
10k views

How can I run BASIC code in a terminal?

I would like to run BASIC code, like you used to do on older computers, in Linux. (I am looking for a BASIC Interrupter that can run OS functions natively) What options do I have? (Preferably for ...
1
vote
1answer
180 views

Question about the unbuffered I/O efficiency introduced in APUE 3th, 3.9

In Advanced Programming in Unix Environment 3th, 3.9, I/O Efficiency, I read about this: The file was read using the program shown in Figure 3.5, with standard output redirected to /dev/null. The ...
0
votes
1answer
41 views

Auto execute a program that plays music

as mentionned above, I would like to execute a programme that plays music at certain hour automatically. I tried using crontab but no outcome. This is what I put in crontab: 8 15 30 3 4 python ...
6
votes
1answer
3k views

How can I list net work devices and ipv4 address on linux without ifconfig/ip command [duplicate]

I already figured out that on Linux I can list network devices (cd /proc/net/dev_snmp6/ && for device in *; do echo $device; done|sort) but how can I get the ipv4 address of the device? I ...