New answers tagged

1

Untested pseudocode: i=1 for d in * do echo "$d" echo Enter Y to rename the above directory: read answer if [ $answer = "Y" ] then mv "$d" tempdir${i} i=$((i+1)) fi done


4

Similar text as ls -ldb * could be produced by (ksh, bash, zsh) $'...', as this: echo $'\0122016\0122016' Which is just a bunch of new-lines (Oct 012, Hex 0x0A) and years. If limited on the shell you could use, then use printf : printf '\0122016\0122016' Note that the above code does not include the last /. Which in fact is not needed to give the name ...


0

C/C++ code #include<cstdio> int main(){ rename(Old,New); } Compile Reeplace Old and New using quotes \" and double back slash \\ g++ -O3 -o bin file.cpp -D Old=\"\\0122016\\0122016/\" -D New=\"new\" Run ./bin


1

zpool replace mypool c9t50060E801331FC42d6 c6t500507630A200568d4 did the trick


2

SunOS 4.x as shipped did not do DNS lookups without NIS. There was an unsupported hack called resolv+ that replaced files in libc.so, which you then relinked, to enable it. You can find more about it in the SunHelp DNS FAQ and older versions of the O'Reilly DNS and BIND book, but I don't know if you can still find the necessary code to do this today. Of ...


-1

As usual on UNIX, the solution is found via checking the man pages. And 30 seconds after calling man du, you should have found the solution: du -sh


1

On Solaris 11, the equivalent would be: gdu -s --si * Solaris 11 has many GNU utilities available, prepended with a g - gtar, etc.


3

du -s command should run under Solaris as well as any decent unix compliant OS. Whereas si or humanly readable output (in 1000s not 1024s) is an option under gnu version of this command, which comes on many, if not all Linux distributions. du -s command should work. If it is not working, you need to provide any errors you are getting. If you think it is ...


-1

You could try Solaris File Events Notification. One approach shown here. Requires at least Solaris v11 though.


-2

You may use while loop... for (( ; ; )) do cp -f /source/*.txt /destination >> /dev/null sleep 2 done Used /dev/null to avoid displaying errors.


4

You can use rsync linux utility. You need to specify source and destination,it works locally as well as remotely. Please check man rsync for more details. For solaris, you'll need to install it.


3

cp -u is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris. On Solaris or any other POSIX-compliant system¹, you can use pax, which has similar functionality. The pax command is POSIX's replacement for the historical cpio and tar commands; in its pass-through mode, it's similar to cp -R. The -u option is similar to ...


2

You might use rsync -u which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13). The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).


-2

find /tmp -type d ! -perm -775 -prune -o -type f -name dsm\*


1

You can just discard those errors and ignore the exit status: find /tmp -name dsm\* -type f 2> /dev/null || : If you still want to keep find's stderr, to still be able to see errors other than failure to enter or list directories because of access permission restriction, you could try and use a syntax that detects those permission issues, but that's ...


0

In your examples, ! -perm -u+rx doesn't evaluate as true - owners still have those rights. You're supposed to use ! -perm -o+rx. So: find /tmp -type d ! -perm -o+rx -prune -o -type f -name dsm\*


-1

I had a similar case, but needed the login date in my custom format. This works for me: date -d "`last -F | head -n1 | sed -r 's/.*\.[0-9]+\s+//' | sed -r 's/\s(still|-).*//'`" +"%F_%R"


3

You should run strings on your program: strings /path/to/binary This will print all strings of (by default) 4 or more printable characters in a row to your terminal. A lot of this will be junk, but if the hostname is actually somewhere in the binary, that should tell you. I agree with you that it is highly unlikely that it will contain things like MAC ...


4

It is explained in Practical Unix & Internet Security as a security feature: uucp has to log in to issue commands, and uucico is a limited-functionality shell, with a separate login/password from regular accounts.



Top 50 recent answers are included