top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we can do array subtraction in bash script?

0 votes
344 views

Here, I want to filter some specific files and directories.

posted Jun 15, 2016 by Amit Kumar Pandey

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

Have the following in xfce autostart:

#!/bin/bash
# Disable screensaver and dpms emergy star.
export DISPLAY :0.0 
xset s off && 
xset -dpms 

on running:

./xset
./xset: line 4: export: `:0.0': not a valid identifier

It appears to be the correct display going by:

echo $DISPLAY
:0.0
+1 vote

I have got a bash script that has two parts.
1. runs a script as a different user (using su -c )
2. when that part finishes, the script does a copy of the files created to another directory
I want to log the output of the entire script into one file. i.e.: internal script>external script> logfile
Whats the best way to do this?

+1 vote

I am trying to understand how to use named pipes in python to launch external processes (in a Linux environment).

As an example I am trying to "imitate" the behaviour of the following sets of commands is bash:

> mkfifo named_pipe
> ls -lah > named_pipe &
> cat < named_pipe

In Python I have tried the following commands:

import os
import subprocess as sp

os.mkfifo("named_pipe",0777) #equivalent to mkfifo in bash..
fw = open("named_pipe",'w')
#at this point the system hangs...

My idea it was to use subprocess.Popen and redirect stdout to fw... next open named_pipe for reading and giving it as input to cat (still using Popen).

I know it is a simple (and rather stupid) example, but I can't manage to make it work..

How would you implement such simple scenario?

+2 votes

I have a process in Linux which can have different memory footprint, I want a program or shell script which can print the time of the day when the memory usage is highest for this process.

Can someone help me.

...