Tag Info

Hot answers tagged

5

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


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. ...


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 ...


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 ...


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


2

If fig is a binary, as opposed to a script, then it will not run on a different operating system. Run file fig to find out (if the output is something similar to ELF 64-bit LSB executable, then it's a binary, if it looks more like Perl script, ASCII text executable, then it's a script and has at least a fighting chance of running on a different platform). In ...


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.


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 ...


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 -> ...


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 ...


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.


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 ...


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 ...


1

You can do it : rdr pass quick on $ext_inf inet proto tcp from any to any port 1394 -> $target port 1394


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 ...



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