If this is system-wide ian it is NOT a unix command ( e.g., a file in /usr/bin, /usr/local/bin, /usr/sbin, yes.
If you do this to a unix command you will break the system - i.e., it probably will no longer reboot, lots of existing code will break.
First, I must emphasize (like Jim did) that you should NOT do this to any binary that is supplied as part of your operating system.
Although Jim's suggestion will make attempts to run binaryfile produce an error message, the error message you get would be something like:
I think what was intended was something more like:
which would instead print:
when someone tries to run binaryfile.
Thank you both for your reply, but the idea would be to avoid manipulating the binary itself, as we need to do exactly the opposite with an allowed binary.
Run it and display a message that this is an allowed binary.
It isn't easy to change the way an application behaves without changing the application.
I almost didn't post this, because the idea of trying to use a system that has been mangled like this is just abhorrent to me. And the same WARNINGS still apply: If you do this to any utility provided as part of your operating system, you may turn your computer into a doorstop.
But, here is a modified version of Jim's code that seems to do what you want. Save it in a file, make it executable, and invoke it with the name of one program to modify as its only argument:
Please do everything you can to convince whoever came up with this idea, that it is a horrible idea and should not be implemented. (Imagine how we'll the above script would work if printf wasn't a shell built-in and you used this script to change printf before you used it to change another program. Any program replaced by this script that has it's output redirected into a file will corrupt that file. Any program replaced by this script that is included in a pipeline will require that the next program in the pipeline be changed to discard the line that the modified program should never have printed.)
Apologies for any typos, and IF this has been done before...
This is yet another building block. The code generates a 256 byte binary file of _characters_ 0x00 to 0xFF for general usage and generates another binary file manipulated in a basic way.
I need this facility for a kids project I am... (0 Replies)
Hello *nix specialists,
Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
We have recently installed RHEL 5.4 on some existing 6.2 OS and migrated our code from RH 6.2 to RHEL 5.4. We are facing a difficulty that given a binary (on both OS they have same name) how can we distinguish that which gcc and OS it was build as there are some minor differences in between binary... (2 Replies)
:confused:
Hi there
I have a requirement to create a variable block binary file on AIX.
Once the file has been feed with info , the file needs to be ftp to MVS.
The problem experienced; when transferring the file to MVS.
MVS does not pick up the carriage return line feed, which OA OD
... (0 Replies)
I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test.
The expect script is run... (2 Replies)
Hi,
I have two Solaris machines.
1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500
2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60
I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Hello,
I am configurating Sendmail on Mac OS 10.x terminal. I tried to execute m4 to generate a new sendmail.cf. It complains "Command not found". Anybody knows where the m4 binary is? Is it something coming along with Unix or Sendmail? Appreciate any help.
Thanks in advance.
pw (2 Replies)
I need to know from a script if a given file is a text file (ascii) or binary.
I need it in order to do dos2unix on each text file - and not on binary files (1 Reply)
Here's the problem...
I'm using a simulator on UNIX, and it requires a filename where bits are stored, it should read them out and do whatever with them at that point..
So what i'm trying to do is make a binary file on UNIX. On my PC i can use MSDEV, or any of my C++ compilers to generate a... (2 Replies)