I am trying to use cleartool to browse some CC repositories. I can get a list of VOBs from lsvob but when I pick a VOB entry, cd into it, and try to do ls . to see what's inside, I get the following error message:
cleartool> ls .
cleartool: Error: Pathname is not within a VOB: "."
The following link says I have to be within a view to run ls but how do I know where to go if I can't get a directory listing -- or a view listing to go to.
http://ejostrander.com/cc_errors.html#ERROR19
It seems kind of like you have to already know where you wanna go to and can't get a list of choices.
Question: How do I go past this point?
Thanks
You must be on Unix in order to be able to do a cd /vobs/aVobTag, but that won't give you anything as long as you aren't in a view (or as long as you didn't do a cleartool setview aViewTag, which would allows /vobs/aVobTag do display anything: see "ClearCase setview").
Plus those are for dynamic view consultation, which means you need to mount the Vob first (cleartool mount)
Create a view first, I recommend a dynamic one (easier and quicker to setup: see "How to open a dynamic view in clear case with a given config specs using command prompt?" as an example), and go to:
cleartool mount /vobs/aVobTag
cd /view/yourView/vobs/aVobTag
You will see files there, provided you had checked in files on the /main branch, since the default config spec of a Base ClearCase view is element * /main/LATEST: see "Config spec in Rational ClearCase".
Related
I have a the following folder :
Folder A
Folder B (which is a symbolic link to Folder A)
The issue is that when I access Folder B, I can go infinitely deeper (ie Folder A > Folder B > Folder B > Folder B) because Folder B is inside Folder A.
Is there any way to ignore Folder B after accessing it via Folder A ?
Thank you very much!
The find command detects symbolic link loops and will print a warning message instead of traversing them repeatedly. For example, using the -L option to follow symlinks may print this warning:
$ find -L /some/path
find: File system loop detected; `/some/path/link' is part of the same file system loop as `/some/path'.
From the man page:
The find utility shall detect infinite loops; that is,
entering a previously visited directory that is an ancestor of
the last file encountered. When it detects an infinite loop,
find shall write a diagnostic message to standard error and
shall either recover its position in the hierarchy or
terminate.
To any programmers looking here (cmdline tool questions should instead go to unix.stackexchange.com):
You should know that the Linux/BSD function fts_open() gives you an easy-to-use iterator for traversing all sub directory contents while also detecting such symlink recursions.
Most command line tools use this function to handle this case for them. Those that don't often have trouble with symlink recursions because doing this "by hand" is difficult (any anyone being aware of it should just use the above function instead).
I'm new to clear case. I need to write a script to find out the files checked out in a view. It should be listing with fileName with directory and who checkout it.
I created findCheckout.sh
cd /vobs/vobElemnt
ct lsco -rec -cview
I executed
ct setview viewName
./findCheckout.sh
It displayed
21-Jul.13:39 idOfWhoCheckedOut checkout version "./src/java/com/package/MyJavaClass.java" from /main/vob_view/view_integ/view_common_source/vobName_source_build/viewName/0 (reserved)
I only want to echo the ./src/java/com/package/MyJavaClass.java and idOfWhoCheckedOut.
How can I get that?
Looking at lsco man page, you should combine your cleartool lsco command with fmt_ccase directive.
ct lsco -rec -cview -fmt "\tElement: %-13.13En Version: %Vn User: %u\n"
That would display only what you want (you can remove the Version part if you don't need it)
That way, the parsing to do is much simpler than trying to awk/cut/sed your way in the full original output of a lsco.
Build the output you want with the fmt_ccase directives.
How do . and .., as paths (vs. ranges, e.g., {1..10}, which I'm not concerned with), really work? I know what they do, and use them all the time, but don't fully grasp how/where they're interpreted. Does the shell handle them? The interpreting process? The OS?
The reason why I'm asking is that I'd like to be able to use ... to refer to ../.., .... to refer to ../../.., etc. (up to some small finite number; I don't need bash to process an arbitrarily large number of dots). I.e., if my current directory is /tmp/let/me/out, and I call cd ..., my resulting current directory should be /tmp/let. I don't particularly care if ... etc. show up in ls -a output like . and .. do, but I would like to be able to call cat /tmp/let/me/out/..../phew.txt to print the contents of /tmp/phew.txt.
Pointers to relevant documentation appreciated as well as direct answers. This kind of syntax question is very hard to Google.
I'm using bash 4.3.42, by the way, with the autocd and globstar shell options.
. and .. are genuine directory names. They are not "sort-cuts", aliases, or anything fake.
They happen to point to the same inode as the other name you use. A file or directory can have several names pointing to the same inode, these are usually known as hard links, to distinguish them from symbolic (or soft) links.
If you are on Linux or OS X you can use stat to look at most of the inode metadata - it is what ls looks at. You will see there is an inode number. If you stat . and stat current-directory-name you will see that number is the same.
The one thing that is not held in the inode is the filename - that is held in the directory.
So . and .. reside in the directory on the file system, they are not a figment of the shell's imagination. So, for example, I can use . and .. quite happily from C.
I doubt you can change them - personally I have never tried and I never will. You would have to change what these filenames linked to by editing the directory. If you managed it you would probably do irreparable damage to your file system.
I write this to clarify what has already been written before.
In many file systems a DIRECTORY is a file; a special type of file that the file system identifies as being distinctly a directly.
A directory file contains a list of names that map to files on the disk
A file, including a directly does not have an intrinsic name associated with it (not true in all file systems). The name of a file exists only in a directory.
The same file can have an entry in multiple directories (hard link). The same file can then have multiple names and multiple paths.
The file system maintains in every directory entries for "." and ".."
In such file systems there are always directory ENTRIES for the NAMES "." and "..". These entries are maintained by the file system.
The name "." links to its own directory.
The name ".." links to the parent directory EXCEPT for the top level directory where it links to itself (. and .. thus link to the same directory file).
So when you use "." and ".." as in /dir1/dir2/../dir3/./dir4/whatever,
"." and ".." are processed in the exact same way as "dir1" and "dir2".
This translation is done by the file system; not the shell.
cd ...
Does not work because there is no entry for "..." (at least not normally).
You can create a directory called "..." if you want.
You can actually achieve something like this, though this is an ugly hack:
You can run a command before every command entered to bash, and after every command. For that you trap the DEBUG pseudo signal and set a command to PROMPT_COMMAND, respectively.
trap 'ln -s ../.. ... &>/dev/null | true' DEBUG
PROMPT_COMMAND='rm ...'
With this, it seems like there's an additional entry in the current directory:
pwd
# /tmp/crazy-stuff
ls -a
# . .. ... foo
ls -a .../tmp/crazy-stuff
# . .. ... foo
Though this only works in the current directory, because the symbolic links is deleted after each command invokation. Thus ls foo/bar/... won't work this way.
Another ugly hack would be to "override" mkdir such that it populates every new directory with these symbolic links.
See also the comments on the second answer here, particularly Eliah's: https://askubuntu.com/questions/327126/what-is-a-dot-only-named-folder
Much in the same way that when you cd into some directory subdir, you're actually following a pointer that points to that directory, .. is a pointer added by the OS that points to the parent directory, and I'd imagine . works the same way.
I want to make a stat via svn,and the input and output like this:
input:svn url,statDate,endDate
output:
person1 20Lines
persion2 30Lines
eg: my.sh http://svn.xxx.com/trunck/xxx/xxx/test.php 2014-12-01 2014-12-10
I use the shell script,and my idea like follows:
1.svn co the whole project
2.get the changed files within a specific date based on the giving url
3.use the command 'svn blame [file url]' get the changed infos by person
but now I don't know how to get the changed files in a directory within a specific date
please give me any ideas,thanks!
You don't want to use svn status, as this only shows if a file has changed in the working copy, whereas you are looking for commit info. You can, however, use
svn log -vq -r {2014-12-01}:{2014-12-10} http://svn.xxx.com/trunck/xxx/xxx/test.php
for your purposes. The -v adds information on the changed paths, the -q suppresses the commit message and only shows the changed paths.
You can then parse this output for the changed paths, user, and revision, and then use svn diff to find out for a given path how many lines were changed by that user in the specified revision.
I am trying to use find to look for files that contain a specific keyword. To my understanding, find takes in a file not a directory (that's why it is giving me error). So is there a way i can go through each sub-directories and look into each and every file to execute the find command so that I can get the result of all files that contains the given keyword? (Much like grep)
So far i got this:
find \S "keyword" "directory\ *"
Error i am getting:
Access denied - Directory name
Access denied - Directory name
.
.
.
Anyone give me a hint? I am current using window 7 right now.
FIND does not take the /s switch (not \s - that's a directory)
FINDSTR is another animal.
About the only quibble about the documentation avaliable from findstr /? from the prompt is that you can target a filemask in a specified directory by specifying \dirname\*, not simply in the current directory as documented. There is also an option to run against a semicolon-delimiter list of directory names - but I've never seen it used.