Hot answers tagged

4

Well, this is not an answer to the question but brings me a solution. so here it is. I fiddle quite a bit with Udev rules, could not get anything better than my Arduino persistently appear on /dev/arduino01 (will use /dev/arduino02, /dev/arduino03,... for other jigs) My testing script is in Python, I just found out that there is a nice library called ...


4

Try: awk '{print; for (i=1;i<=31;i++) {x=$0; gsub(/sel0/, "sel" i, x); print x;}}' RS="" file For example, and limited to 3 repetitions: $ awk '{print; for (i=1;i<=3;i++) {x=$0; gsub(/sel0/, "sel" i, x); print x;}}' RS="" file cr_v8_sel0 : cross cp_v8_en, cp_sel0 { ignore_bins ig_v8_sel0 = binsof(cp_v8_en) && binsof(cp_sel0) intersect {[...


3

With a here document: for i in {0..31}; do cat << EOF cr_v8_sel${i} : cross cp_v8_en, cp_sel${i} { ignore_bins ig_v8_sel${i} = binsof(cp_v8_en) && binsof(cp_sel${i}) intersect {[0:3],[5:$]}; } EOF done Note that if you use this method, you need to be a careful that there is nothing else in the here-document that might get expanded by ...


3

You can use the -c option of su to pass a single command. su root -c 'sh /home/jay/script-that-needs-executing-as-root.sh'


3

PYTHONHOME Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local. When PYTHONHOME is set to a single directory, its value replaces both prefix ...


2

Save each command's PID number using bash's special shell var '$!' which is the process pid of the last command, then just check '/proc/PID' existence before trying to run the command again. #!/bin/bash do_cuckoo() { python /opt/cuckoo/cuckoo-2/cuckoo.py 1>cuckoo_script/cuckoo_start.txt 2>&1 & echo $! >/tmp/cuckoo.pid } do_web() { ...


2

See this similar stackoverflow question. The pgrep command can check the existance of a running process. The comman pgrep -f <file> will return the number of current instances of the specified file. For example: [user@localhost ~]$ pgrep -f /sbin/init 1 [user@localhost ~]$ It will return nothing if the file is not associated with a process. This ...


2

Make an input file sel.txt, (nothing fancy, only what the OP had with no changes), run a bash loop, and use sed in there to do the work: echo "cr_v8_sel0 : cross cp_v8_en, cp_sel0 { ignore_bins ig_v8_sel0 = binsof(cp_v8_en) && binsof(cp_sel0) intersect {[0:3],[5:$]}; }" > sel.txt for f in {0..31} ; do sed 's/sel0/sel'$f'/g' sel.txt ; done


1

There are quite a few different ways to automount storage devices on linux. Even the location of the mounts varies quite bit. Also not all system are set up to automount devices and some desktop environments will automount when you access them others when you plug them in. Basically, to make it portable you cannot rely mount points in a location to find ...


1

Package: webcheck Description-en: website link and structure checker webcheck is a website checking tool for webmasters. It crawls a given website and generates a number of reports in the form of html pages. It is easy to use and generates simple, clear and readable reports. Features of webcheck include: * support for http, https, ftp and ...


1

udev does not have only serials to match devices, you can use any property available. So you can use almost any thing different in udevadm info /dev/... & udevadm info -a /dev/... from both devices with same serials. If you can share those outputs for each device, I may able to help. From your answer, it seems you already got vendor/model not the same, ...


1

If apt is borked, sometimes it's possible to set things right manually with dpkg and the full path of the local cached package. Here's how: cd to where apt stores the packages, namely /var/cache/apt/archives/ dpkg then (as needed) the switch for install, remove, purge or whatnot, then the filename of the package in the current directory. So to install ...


1

You should be able to configure lxml to find your own version of libxml2 and libxslt using the --auto-rpath install option. First, uninstall your current version of lxml. pip uninstall lxml Then, add xml2-config and xslt-config to your path. export PATH=/home/hsundara/packages_installed/libxslt-1.1.28/bin:/home/hsundara/packages_installed/libxml2-2.9.1/...



Only top voted, non community-wiki answers of a minimum length are eligible