Tag Info

Hot answers tagged

44

The -f option is definitely what you want to be using. The confirmation about file permissions it refers to is this: $ touch myfile $ chmod 400 myfile $ rm myfile rm: remove write-protected regular empty file `myfile'? So rm will warn you if you try to delete a file you don't have write permissions on. This is allowed if you have write ...


7

I'm way late to the party, but I use this all the time. In a makefile, add - to the beginning of a line to ignore the return value of that line. Like so: -rm lexer.ml interpparse.ml interpparse.mli


7

If all you need is a byte-by-byte comparison, use cmp: if cmp -s "$a" "$b"; then echo Same else echo Differ fi This avoids wasting time for diff's difference finding algorithm.


6

If you find some way to glob the file names, rm won't complain if it can't find a match. So something like lexer.m* interpparse.*, etc. should work for you (be careful you're not deleting too much, of course). Also, -f is a perfectly reasonable way to go, as long as you're not hoping that file permissions will save you from deleting a file you didn't want ...


4

Makefiles allow easy parallelization. Since make is (made) aware of dependencies, it can arrange jobs in such a manner that all the cores on the system are used as effectively as possible.


4

This is a section of my .vimrc: " enable filetype detection: filetype on filetype plugin on filetype indent on " file type based indentation " recognize anything in my .Postponed directory as a news article, and anything " at all with a .txt extension as being human-language text [this clobbers the " `help' filetype, but that doesn't seem to prevent help ...


3

The simplest is to use cygwin and run linux command. Another way is to use nmake command provided by the windows SDK but, in this case, you have to edit some part of the makefile. I suggest the first solution. Hope this helps


3

(cd /other/dir && make) will not change your shell's current directory, but will run make with the indicated working directory. The && will ensure that make doesn't run if there's an error in the cd part of the command (e.g., the directory doesn't exist, or you don't have access to it).


3

Cygwin as an environment in not obligatory. Here is a Windows ready ELinks package without a need for Cygwin environment: http://www.compmiscellanea.com/soft/windows/browsers/elinks/1/elinks-0.11.6.zip Download, unpack and run. [ http://www.compmiscellanea.com/ru/konsolnye-prilozhenija-dlja-windows-veb-brauzery.htm#elinks ]


2

If you don't want to use the -f option, an alternative is: rm filethatdoesntexist 2> /dev/null This will just keep errors from being printed.


2

The -f option means that you will not be prompted if something is not as expected. It does not mean that permissions are not taken into account. If you have not enough privileges to remove a file, it won't be removed. BUT, if you have enough privileges to change privileges, you file will be removed. This is the case when you are the owner of a file with ...


2

So, you're right that this in not a huge task,the advantages offered by make right now are As Ignacio says make is parallel building aware. Use the -j flag. If you have expressed you dependencies correctly make never rebuilds things that don't need it. Sure, you can get that in a bash script, but it means adding complexity to the script (and I'd have to ...


2

You do not explicity ask to link agaist libdl in the Makefile. You should try if adding in manually resolves this (if it is added automatically could depend on your compiler). LDFLAGS+=-ldl


2

Use ${PRODUCT_NAME}_OBJC_FILES. The curly braces tell Bash explicitly where the variable name ends.


2

Use an archive format like cpio or tar to preserve hard links. See cpio(1) and tar(1). Also, cp only preserves hard links if you use -l or -a. [EDIT] All tools on Unix detect hard links by looking at the inode number (first number in output of ls -li). If the number is different, then no tool can recreate the hard links. To fix the issue, I suggest to ...


2

Not sure what you mean inefficient, but my guess is 'no'. The kernel handles all the symlinks, gnumake just does an open() and it gets the file. Any user level app doesn't care (well, rarely cares) about whether it's a symlink or not, it just gets the file. The extra levels of symlinks the kernel needs to go through are insignificant vs. the time to ...


2

Another alternative is MinGW, which can compile to a native Win32 program.


2

Hope this will help you. Android.mk file syntax specification Document by some user Pierr Chen's Blog


2

It doesnt provide all that by default, it was designed in a time when php probably didnt exist.. The most basic tutorials will say that the format is similar to below <target> : < prerequisites> <shell command> Where target might be files, prerequisites are optional but typically are files. Based on this you could replace the ...


2

You might need an additional bash-completion package, take a look at http://stackoverflow.com/questions/4188324/bash-completion-of-makefile-target More relevant information can be found at http://www.cyberciti.biz/faq/fedora-redhat-scientific-linuxenable-bash-completion/ First, turn on the EPEL repo and type the following yum command to install ...


1

Q1: Im not 100% sure about the $* since there are soo many variants. I usually use $@ to select the targets, but maybe $* is more correct. Q2: I can say about your question 2 that this is standard bash. The call cmda || cmdb (Which is an or statement) can also be understood as if cmda doesn't succeed, then try to call cmdb and see if that will succeed ...


1

uninstall: rm -f $(addprefix $(MANDIR), $(MANPAGES)) .PHONY: uninstall Note: make sure you use a [TAB] instead of eight spaces.


1

Instead of doing this with autocmds, you could create your own user filetype plugin for each filetype, and place it in ~/.vim/ftplugin/<filetype>.vim, where <filetype> is the actual file type you want. For example: mkdir -p ~/.vim/ftplugin echo "setlocal noexpandtab" > ~/.vim/ftplugin/make.vim You do need to make sure you have filetype ...


1

I think there should be a main Makefile in the root directory that contains a command such as include ./make.inc. Or add on top of each subfolder\Makefile file: include ../make.inc I found a nice example at: http://owen.sj.ca.us/~rk/howto/slides/make/slides/makerecurs.html


1

MATLAB Compiler mcc is the MATLAB command that invokes MATLAB Compiler. You can issue the mcc command either from the MATLAB command prompt (MATLAB mode) or the DOS or UNIX command line (standalone mode). mcc prepares MATLAB file(s) for deployment outside of the MATLAB environment, generates wrapper files in C or C++, optionally builds ...


1

Yes: if diff "$file_a" "$file_b" &> /dev/null ; then echo "Files are the same" else echo "Files differ" fi


1

Well, across different machines the uid/oid/gid can have different values unless you're using something like LDAP. Even then, the users which are defined on your system will have their own id-s. There is no guarantee that the user will exist on another machine. Perhaps you should further explain your use case?


1

Use the %files section of your RPM's .spec file to set the ownership expected on the installed system (System 2 in your question). You may also use the %pre section of your RPM's .spec file to determine if the expected users and groups actually exist on the installed system (System 2 in your question). %files # Set file permissions and ownership %pre # ...


1

Each command line in a Makefile is launched into a separate shell process.  To get a cd to work, do cd $(PROJECT_FOLDER); zip -r dist/$(ARCHIVE) $(PROJECT_FOLDER) i.e., all on one line. Optionally, for clarity, you could say cd $(PROJECT_FOLDER); \ zip -r dist/$(ARCHIVE) $(PROJECT_FOLDER) i.e., make it one logical line, but break the pieces into ...


1

You are setting PATH to "" you even commands in /usr/bin can't be found. I assume you want to add .. to PATH. What you want is: $(shell PATH="$(PATH):.." ./something.sh) Assuming you are doing something with the output of something.sh, if not then: PATH=$(PATH):.. ./something.sh Is all that is required.



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