Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix if the file does not have extension

  • Loading branch information...
commit a4e94cb516ad1313dba9f630cbd120256c0ace0f 1 parent f5a873d
taylorchu authored April 12, 2012

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  xdg-open
8  xdg-open
@@ -42,8 +42,12 @@ if [[ "$arg" =~ ^([a-zA-Z]+): ]]; then
42 42
 	program=$(find_program "$protocol")
43 43
 elif [[ -f "$arg" ]]; then
44 44
 	# handle file
45  
-	filename="$@"
46  
-	ext="${filename##*.}"
  45
+	if [[ "$arg" == *.* ]]; then
  46
+		# have file extension
  47
+		ext="${arg##*.}"
  48
+	else
  49
+		ext=""
  50
+	fi
47 51
 	program=$(find_program "$ext")
48 52
 elif [[ -d "$arg" ]]; then
49 53
 	# handle directory

0 notes on commit a4e94cb

Please sign in to comment.
Something went wrong with that request. Please try again.