Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: scripts/get_log

Issue 4105005: This fixes a really tiny thing in handling of symbolic links (Closed) Base URL: http://git.chromium.org/git/userfeedback.git
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # This script looks to see if a log file is zero length, or non 7 # This script looks to see if a log file is zero length, or non
8 # existent before writing something to stdout, so that we don't end up 8 # existent before writing something to stdout, so that we don't end up
9 # with empty entries that just look broken. 9 # with empty entries that just look broken.
10 10
11 max_lines=${2:-1000} 11 max_lines=${2:-1000}
12 12
13 file=$1 13 file=$1
14 if [ -h "$file" ]; then 14 if [ -h "$file" ]; then
15 file="$(readlink $file)" 15 file="$(readlink -f $file)"
16 fi 16 fi
17 17
18 if [ -r "$file" -a -f "$file" ]; then 18 if [ -r "$file" -a -f "$file" ]; then
19 size=$(/bin/ls -s "$file") 19 size=$(/bin/ls -s "$file")
20 # Get the first field. 20 # Get the first field.
21 size=${size%% *} 21 size=${size%% *}
22 if [ $size -gt 0 ]; then 22 if [ $size -gt 0 ]; then
23 /usr/bin/tail --lines=$max_lines "$file" 23 /usr/bin/tail --lines=$max_lines "$file"
24 else 24 else
25 echo "<empty>" 25 echo "<empty>"
26 fi 26 fi
27 else 27 else
28 echo "<not available>" 28 echo "<not available>"
29 fi 29 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698