Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gmt_links.sh 1.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
  4. # See LICENSE.TXT file for copying and redistribution conditions.
  5. #
  6. # This script creates, removes, or lists symbolic links for each GMT
  7. # module to the main GMT executable that allow users to run modules
  8. # directly.
  9. #
  10. # Run this script on the command line with:
  11. # $(gmt --show-sharedir)/tools/gmt_links.sh create|remove
  12. #
  13. # With no arguments we simply check for the links.
  14. #
  15. # It expects the GMT executable to be in the search path and that
  16. # you have permission to perform the changes in the bin directory.
  17. # check for bash
  18. [ -z "$BASH_VERSION" ] && return
  19. if ! [ -x "$(command -v gmt)" ]; then
  20. echo 'Error: gmt is not found in your search PATH.' >&2
  21. exit 1
  22. fi
  23. if [ "X$1" = "Xdelete" ]; then
  24. mode=1
  25. elif [ "X$1" = "Xcreate" ]; then
  26. mode=2
  27. else
  28. mode=0
  29. fi
  30. bin=$(gmt --show-bindir)
  31. cwd=$(pwd)
  32. gmt_modules=$(gmt --show-classic)
  33. compat_modules="minmax gmtstitch gmtdp grdreformat ps2raster originator"
  34. cd $bin
  35. for module in ${gmt_modules} ${compat_modules}; do
  36. if [ $mode -eq 1 ]; then # Delete links
  37. rm -f $module
  38. elif [ $mode -eq 2 ]; then # Create new links (remove old if present)
  39. ln -sf gmt $module
  40. else # List what we find
  41. if [ -h $module ]; then
  42. printf "Link for module %16s: %s\n" $module "Present"
  43. else
  44. printf "Link for module %16s: %s\n" $module "Absent"
  45. fi
  46. fi
  47. done
  48. cd $cwd
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...