How to count files in the directories with scripts for Solaris? - solaris-10

find dirlocation -type d | while read dir; do
count=$(find "$dir" -type f | wc -l)
echo "$dir ; $count"
done
This script working fine on Linux environment but when I run this on Solaris then message is Variable syntax. Can anyone help me to sort out this problem please?

Your script is written in the bash shell dialect. It will run on Solaris, too, but only within a bash shell. If you choose a different shell under Linux, it will stop running there, either.

Related

Cannot run sikulix script from command prompt(Windows 10). I can launch the ide and run it though

Sikuli version -2.0.5 I can create a script created from the sikuli IDE and run it using the Run button located at the top.
However I cannot get it to run from a command line? Any ideas?
You can understand it better from here
[https://sikulix-2014.readthedocs.io/en/latest/faq/010-command-line.html][1]
But i would say that you have to write something like this to make it work.
1 - Run CMD in admin
2 - Type something like the following command:
java -jar <PATH_TO_SIKULI> -r (run) <PATH_FOR_SIKULI_PROJECT> (ends as .sikuli) -v (verbose in the console) -f (saves log file in path) <WANTED_LOG_FILE_PATH>
Example:
java -jar C:\Sikuli\Sikulli_2_0_5\sikulixide-2.0.5-win.jar -r C:\Sikuli\tests.sikuli -v -f C:\Sikuli\Sikulli_2_0_5\SikuliLog.txt
You can use help like java -jar <PATH_TO_SIKULI> -h to understand how you can adjust it for your needs.

`mcu8051ide` on Linux mint 19 not working or opening

mcu8051ide on Linux mint 19 not working or opening, all dependencies are installed but when I check libraries, itcl is not present is the error.
I am confused what to do?
I installed Linux mint 19 in a virtual machine to check out what's going on.
The Itcl 3.4 pkgIndex.tcl file has the following contents:
# Tcl package index file, version 1.0
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded Itcl 3.4 [list load [file join /usr lib x86_64-linux-gnu "libitcl3.4.so.1"] Itcl]
This means that Itcl will only be available with Tcl 8.6. However, mcu8051ide specifically starts tclsh8.5. That's the reason it can't find Itcl.
The mcu8051ide command is a very short shell script that only starts tclsh8.5 and passes /usr/share/mcu8051ide/lib/main.tcl as the script to run. If instead you run that script with tclsh (which is a symbolic link that points to tclsh8.6), it seems to work at first glance.
So, you can either modify the original startup script, or put a modified copy in your own bin directory.
go to /usr/local/share/mcu8051ide/lib
(or to /usr/share/mcu8051ide/lib depending on config during cmake)
and then edit the main.tcl file
using sudo nano main.tcl
On the 51st line,
change the value for MIN_TCL_VER from 8.5 to 8.6.

How to rebuild a Fedora package with a different compiler?

Similarly to this question ("How can I automatically rebuild a package with a different compiler?" on askubuntu.com), I would like to know how can I automate fetching source and compilation of a C program using Fedora build scripts using a specific, non-default compiler - in my case afl-gcc. I would definitely welcome an example of the pv program, but I would like the solution to work for other packages, like libreoffice as well, with minimal modifications. I would like to achieve something similar to aflize (which is for Debian only right now). I have heard of mock and it would be best if I could use it for that.
I do not know to do it automatically, but manually:
Prepare build environnement
$ rpmdev-setuptree
Download corresonding srpms
$ yumdownloader --source foo
Extract files from SRPMS
$ rpm -i foo*.src.rpm
Replace the compiler used
$ sed -i 's/make all/make CC=afl-gcc all/g' ~/rpmbuild/SPECS/foo.spec
setting CC var your corresponding compiler will do the jobs.
If you use cmake take a look to CMAKE_C_COMPILER
Rebuild
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -ba foo.spec
Generated rpm files are located into ~/rpmbuild/RPMS

How do I find the path to the tclsh running my script?

From my Tcl script, I would like to find the path to the tclsh executable which is running my script (like sys.executable in Python), or at least find how the tclsh was invoked from the command line (like $^X in Perl)?
Just found it by myself: It's
info nameofexecutable

how to use spawn command in TCL

I am using the following code
#!/usr/bin/expect -f
#!usr/bin/expect
#package require Expect
puts "Hello world"
spawn ssh xyz#172.31.112.182
expect -nocase "password:"
send "abc123\r"
puts "done"
while executing, it throws error
Hello world
invalid command name "spawn"
while executing
"spawn ssh xyz#172.31.112.182"
(file "temp.tcl" line 9)
whats the wrong in my code
remove '#' before package require Expect.
The problem you've got is that while it is running in Tcl (I recognize that format of trace), the Expect package (which provides the spawn command) is absent for some reason. The first thing to do is to make the requirement for the Expect package explicit by uncommenting that package require line. That may be enough to fix your problem in itself, but if not it will complain about the package not being available. If it's not available, that means either that it just isn't installed, or that it's not being found. The former is... obvious to fix. :-) The latter is resolved by putting a line like this before that package require:
lappend auto_path /full/path/to/Expect/package/installation
Note that if you run the script with the expect program instead of the tclsh program, that package require will be done for you automatically. You're obviously not doing that…
Try running under tcl interpreter (!/usr/bin/tcl) and import Expect.
Did you installed Expect on your PC?
Please run the following command on your PC to check if Expect is available.
$which expect
/usr/bin/expect
sudo apt-get update -y
sudo apt-get install -y expect
which expect
Run the above commands respectively. If installed correctly, "which expect" will show "/usr/bin/expect" as an output. Run your script after installation,