this is my first time dabbling in bash scripting and first time using this site. I’m working on script that’s meant to provide the user with a list of software packages to install and then output their choices into a 2nd script file that can be run later to actually install their choices. So far m…
Tag: linux
rlim_t errors with login_cap.h in Debian
I’m trying to compile the bsdmainutils package in Debian that uses the /usr/include/login_cap.h header (from libutil-freebsd-dev), and I’m getting a bunch of errors like this: I’m using Debian testing. Is this a bug in login_cap.h? I see rlim_t defined in /usr/include/x86_64-linux-gnu/bits/r…
Copy first N files which start with ‘a’ ‘c’ or ‘e’ from one folder to another in Linux
I have many files in specified directory. For instance, I want to copy 6 of them to one location. I came up with this: The problem is that every file which starts with ‘a’ ‘c’ ‘e’ is copied. There should be first 6 files, but I receive 8 (4 with ‘a’, 3 with R…
Paths must precede expression Linux find
I have the following command: I get the error “find: paths must precede expression: 1990” Why is this? I have quoted the wildcard, so I don’t see the error. How to fix this? Thanks! Answer You need to repeat the -iname argument:
“su ” fails with “standard in must be atty”
I researched this question and all answers suggest visudo to add: Defaults:user !requiretty It does not work! I have two Linux boxes (RedHat). I have a Java class which uses ProcessBuilder/Process to execute commands. The class runs under a system account. On both boxes, I run and provide the password for oth…
Need help to this bash/shell exercise
The output of this line if expr $x+1 1> /dev/null 2>&1 I really don’t figure out how things go there… Answer Modify your script like this (simple add spaces around the +): expr tries to add 1 to the value of the variable. If the status is 0 (value of $?) it is a number. Otherwise, there …
Script to plot multiple graphs in gnuplot
I try to write a script which will be executed by the shell to use several txt-files in a directory to plot multiple lines in a graph with gnuplot. So if I type in the command for one picture, the results are as imagined. Here you can see the command: Now my Script looks like this: The script edits every
Read first line in a file and append it to first occurrence of the search string and Repeat until EOF
I have a file with following lines in a text file in following format And a json file in following format Now i want output of json as follows So how can achieve this using bash? I’ve tried with following but it only appends last line of the file. Answer This will do it:
Demon function on RHEL 7
I have script in RHEL 6 which is using default function such as /etc/rc.d/init.d/functions can we use same functions on RHEL 7 to start the daemon process? . Also let me know, if there is any difference for /etc/rc.d/ between RHEL 6 and RHEL 7? Answer This file is provided by the initscripts package, which is…
Can process move from Ready Queue to Job Queue?
I’m working on a program that would simulate scheduling from creation to completion of processes. I need assistance to know can a process move back from ready queue to the job queue (in any case – may be an exception). Answer I’m not sure what you mean by “queue job”. A process i…