Tag Info

New answers tagged

1

Lets add some Debugging Info, like so: $f = fopen('mmascript.m', 'w'); echo "fopen complete." fwrite($f, "#!/Applications/mma/Contents/MacOS/MathematicaScript -script\n"); echo "fwrite 1 complete." fwrite($f, 'Print[100]'); echo "fwrite 2 complete. fclose($f); echo "close complete." chmod('mmascript.m', 0777); echo "Permissions Successfully Changed." ...


1

As @Stephen Kitt said, if OSX supports namespaces, the command is unshare. See: [romano:~] 1 % route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 192.168.1.0 * 255.255.255.0 U 9 0 0 wlan0 ...


3

If you have already become root you don't need to use sudo again. So in your second example, after the su root just run visudo directly su root visudo


0

One option is to use more e.g. more file.txt However it does not have all the feature added by less. One simple example is that you can't scroll back up in the output. Generally it has been superceeded by less - which was named in jest because less is more


1

find does not sort the files, it lists them out in the order it finds them. It also traverses directories in the order it finds them. You cannot make any assumptions about the order but I believe it will be repeatable in the sense that if you run find again, you'll get the same order. On Linux, files are not stored in alphabetical order. Maybe they are on ...


0

So I found it out myself by scouring the web. You just use the path to the truecrypt executable in the app bundle: /Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -h The above command will get you the help option to see what other options there are for TrueCrypt. Also, here is one of the sources I found for the code: mount-dev-volumes.sh


0

These files are test scripts for your Apache installation in a Windows environment. Bear in mind that Apache may be installed on various platforms and the maintainers are likely to package test scripts for all platforms in the same bundle, it's not uncommon. I have never installed apache on Windows though and searching but Google Allmighty reveals these ...


1

My answer to this was to do 2 things: First have the .bashrc line use this so that it works on OSX: [ `uname -s` != Linux ] && exec tmux Secondly, for Ubuntu, change the terminal profile to use tmux directly, e.g. on check the custom command enter tmux, e.g. For quake I also had to update preferences (right click while using it -> ...


0

From what Step 3 of link shows, it seems as if this is expected behavior. Maybe they left it out of the screenshot because it just gets appended anyway?


0

In addition to Michael Mrozek's answer: On OSX 10.10 (Yosemite) you can have to use these attrx parameters: xattr -l file xattr -w attr_name attr_value file xattr -d attr_name file


1

I see you've tagged your question osx so if you've done this on a mac, make use of the GUI. Open any Finder window and press cmd shift G Type /etc/sudoers and press return to go to the file Press cmd i with the file highlighted Scroll to the bottom of that info window to 'Sharing & Permissions` and click the lock icon in the bottom right Type an admin ...


3

Could you just run your commands in a screen or tmux session in the VM? That would allow multiple steps to connect/send commands to the same session


0

From chsh manual: When altering a login shell, and not the super-user, the user may not change from a non-standard shell or to a non-standard shell. Non-standard is defined as a shell not found in /etc/shells. So you need either to run chsh as root (sudo chsh -s /usr/local/bin/bash user), either to add /usr/local/bin/bash to /etc/shells (sudo echo ...


0

In my case, I found that VirtualBox was interfering with VMWare Fusion 7.1 on Yosemite. The solution was to completely uninstall VirtualBox using this script. Download VirtualBox_Uninstall.tool Open the Terminal Browse to the directory where you downloaded it Run it with sudo sh VirtualBox_Uninstall.tool


3

My apologies, but reading your statement The exact text I want to insert after end of the HEAD section is... led me initially to believe we were talking about appending text to file section rather than inserting before - so I wrote that answer first. After rereading the question, and more closely studying your example sed command - I think I understand this ...


4

In-place sed requires making a backup file during the process. The -i option on Apple's sed requires an extension argument (for the backup file it creates) and consumes the next argument. That means you're telling it you want it to make a backup file with the extension "#s</head>#...". The error means it thinks you're referring to the append command. ...


1

Even though everybody uses cat filename to print a files text to the standard output first purpose is concatenating. From cats man page: cat - concatenate files and print on the standard output Now cat is fine for printing files but there are alternatives: echo "$(<filename)" or printf "%s" "$(<filename)" The ( ) return the value of an ...


0

Replace --color with -G when running ls.


4

The default shell for root on OS X is /bin/sh. Its sh is also a version of bash, but when invoked with the name sh Bash: tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or as a non-interactive shell with the --login ...


1

The root user will try to execute the .bashrc file instead of the .bash_profile since you are not invoking a login shell. From the bash manual man bash: ~/.bash_profile The personal initialization file, executed for login shells ~/.bashrc The individual per-interactive-shell startup file Note the ~ where the .bashrc file needs ...


1

Because it is not considered as a "login shell" (which is invoked directly from login, or sshd) but simple "interactive shell". See here for example: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html So force su using login option i.e. with -l option: su -l Or put your environment into .bashrc file.


1

Here is a shell-only solution for the three cases you have in your question: for f in *.png.png ; do mv -i "${f}" "${f%.png}" ; done for f in *.jpeg.jpg ; do mv -i "${f}" "${f%.jpeg.jpg}.jpg" ; done for f in *.JPEG ; do mv -i "${f}" "${f%.JPEG}.jpg" ; done Type it in the directory where the files are to be renamed. If you like to generalize this type ...


2

Here is something using find to rename *.png.png -> *.png: find ./ -name '*.png.png' -type f \ -exec sh -c 'mv {} ./$(basename -s .png.png {}).png' \; It isn't really gerenic, so you have to customize it for the other file extensions.


0

Try the SSH configuration as suggested by Georgyo's answer. If that doesn't work you're likely running up against some kind of connection time limit imposed by a firewall somewhere. If that's the case and you have no way of removing the timeout you can try using something like screen to keep the process running even when your ssh session disconnects. I ...


0

You need to install either Homebrew or YUM. I recommend using HomeBrew. To install it enter the following command in terminal. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" then use brew install Package_name


1

How about (notice the backslashes, all important): echo brew\ {install,update,doctor}\;| bash the first pattern (arguments for echo) will expand thusly: echo brew install; brew update; brew doctor; which is then echoed, producing this output: brew install; brew update; brew doctor; which we pipe to a new bash instance.


5

xargs seems to be what you want: echo install update doctor | xargs -n1 brew


1

Escape the first space and remove the other spaces: $ printf "'%s'\n" brew\ {install,update,doctor} 'brew install' 'brew update' 'brew doctor' If brew is a command just write (also without the spaces): brew {install,update,doctor} like with your mkdir example: mkdir {install,update,doctor} You need no external process or piping to do that; all can ...



Top 50 recent answers are included